-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support index based url for notebook cells #147183
Comments
cc: @rchiodo |
Dig into this a bit and find that to make this happen, it would require following changes:
|
Discussed offline with @joyceerhl , with above items we can make the cell index url work in VS Code desktop with remote hub. To support the url in github/vscode.dev:
|
Above diagrams show what changes we might need to make to support this style of link
|
Had offline discussions with @lramos15 and @sbatten on proposed changes to have the notebook cell index support in Web scenarios (vscode/github.dev). Here is the gist of our discussions and some of our proposals. vscode/github.dev are constructing the workbench based on the info from the url (parse the path and fragments) and providing the default views and editors to open to VS Code. The workbench construction info is defined as interface IWorkbenchConstructionOptions {
readonly defaultLayout?: IDefaultLayout;
...
}
interface IDefaultLayout {
readonly views?: IDefaultView[];
readonly editors?: IDefaultEditor[];
...
}
interface IDefaultEditor {
readonly uri: UriComponents;
readonly selection?: IRange;
readonly openOnlyIfExists?: boolean;
readonly openWith?: string;
}
First one is extending export interface IDefaultEditor {
readonly uri: UriComponents;
readonly selection?: IRange;
readonly openOnlyIfExists?: boolean;
readonly openWith?: string | { id: string; options?: Record<string, any> };
} Second option is replacing export interface IDefaultEditor {
readonly uri: UriComponents;
readonly options?: IEditorOptions;
readonly openOnlyIfExists?: boolean;
readonly openWith?: string;
} Exposing the whole export interface IDefaultEditor<T extends Pick<IEditorOptions, 'override'> {
readonly options?: T;
} Last options is from @logan. The idea behind this is passing the original fragment and query parameters of the browser url to the custom editor opening the resource and the custom editor itself can decide how it wants to parse the fragment/params. export interface IDefaultEditor {
readonly uri: UriComponents;
readonly selection?: IRange;
readonly openOnlyIfExists?: boolean;
readonly openWith?: string;
readonly params?: Record<string, string>;
} I'd love to have feedbacks from @joaomoreno and @bpasero, especially on what approach we take to extend the editor options support in web embedder api. |
I like the idea that we make it the editor resolver's responsibility to parse a The idea from core workbench editor service was always that
|
I think we already picked a solution for the opener to convert the
and
|
I like this idea. It would be natural if the editor resolver parse the resource Uri but it seems now that we have quite some syntax for file fragment. The EditorOpener, the QuickAccess, the CLI and lastly github.dev all have different styles of line/col syntax. It will be quite some effort to unify them and have a standard of way constructing/parsing the Also @joyceerhl mentioned there is probably a reason why we didn't put the fragment in the
Since the reality now is each editorService user has their own logic of handling Uri#fragment. I actually prefer this a bit more. The workbench editor service get an |
There is always a risk that encoding these kind of options in the For the opener we probably did not have much choice because the protocol service in the OS only allows to pass in a path to the application and not additional information, so we end up encoding everything into that path. I think a similar challenge exists for drag and drop where the transfer object is most often also just a resource. |
I tried testing this by running |
Doesn't seem to work for me, open the wrong notebook for when giving it https://insiders.vscode.dev/github/microsoft/vscode/.vscode/notebooks/my-endgame.github-issues#C13 Screen.Recording.2022-04-27.at.12.06.20.mov |
@jrieken that URL seems malformed, should it be https://insiders.vscode.dev/github/microsoft/vscode/blob/main/.vscode/notebooks/my-endgame.github-issues#C13 |
Oh, you are right. Closing as verified but I really need an action to generate these links for me |
Provide a url for cell locations like
https://github.com/owner/repo/blob/master/notebook.ipynb#C2:L6-10
The text was updated successfully, but these errors were encountered: