I need a mechanism to associate a notebook to my resolved JupyterServer (if applicable).
Why?
My extension resolves remote Jupyter servers. I'd like to offer language support for them. Each of my remote servers are running a language server I can connect VS Code to, by registering a LanguageClient. I've prototyped this and it works. Context in #17092, where I've discussed this approach. Diagnostics / LS info from my remote servers are only relevant to notebooks connected to it. E.g. if you install numpy in one of my remote servers, diagnostics should reflect that only when the notebook editor is connected to it.
Existing APIs
The VS Code and Jupyter APIs available today are insufficient for this use-case. Since as a JupyterServerProvider I don't own or have a handle on the NotebookController, I can't find a mechanism to make the association.
Design
There are a ton of options and variations for how the Jupyter API could extend to support this, including:
onDidNotebookConnect: Event<{NotebookDocument, JupyterServer}>: An event fired when a notebook connects to a resolved server the provider resolved.
getNotebooks(serverId: string): Set<NotebookDocument>: A method getting the collection of notebook documents that are connected to the JupyterServer.
I'd really love to leverage this prospective feature, more than happy to implement (if we can first align on an approach). Alternatively, if I'm overlooking any API, or combination of APIs, to accomplish my goal I'd love to know! I didn't have permission to re-open or comment on this related issue I'd previously filed - #16487. As mentioned in this comment I found a reasonable workaround.
I need a mechanism to associate a notebook to my resolved
JupyterServer(if applicable).Why?
My extension resolves remote Jupyter servers. I'd like to offer language support for them. Each of my remote servers are running a language server I can connect VS Code to, by registering a
LanguageClient. I've prototyped this and it works. Context in #17092, where I've discussed this approach. Diagnostics / LS info from my remote servers are only relevant to notebooks connected to it. E.g. if you installnumpyin one of my remote servers, diagnostics should reflect that only when the notebook editor is connected to it.Existing APIs
The VS Code and Jupyter APIs available today are insufficient for this use-case. Since as a
JupyterServerProviderI don't own or have a handle on theNotebookController, I can't find a mechanism to make the association.Design
There are a ton of options and variations for how the Jupyter API could extend to support this, including:
onDidNotebookConnect: Event<{NotebookDocument, JupyterServer}>: An event fired when a notebook connects to a resolved server the provider resolved.getNotebooks(serverId: string): Set<NotebookDocument>: A method getting the collection of notebook documents that are connected to theJupyterServer.I'd really love to leverage this prospective feature, more than happy to implement (if we can first align on an approach). Alternatively, if I'm overlooking any API, or combination of APIs, to accomplish my goal I'd love to know! I didn't have permission to re-open or comment on this related issue I'd previously filed - #16487. As mentioned in this comment I found a reasonable workaround.