Language-server-protocol: Add OpenBrowser Notification

Created on 25 Aug 2016  路  6Comments  路  Source: microsoft/language-server-protocol

It would be nice to have a standard way for the server to ask the client to open a URL in the browser.

This can be an addition to the existing window service. Somethink like this.

OpenBrowser Notification

The open browser notification is sent from a server to a client to ask the client to open a particular URL in the web browser.

_Notification_:

  • method: 'window/openBrowser'
  • params: OpenBrowserParams defined as follows:
interface OpenBrowserParams {
    /**
     * The URL to open.
     */
    url: string;
}
feature-request help wanted

All 6 comments

This would be awesome. But the question is wether this should be a Notification - I could imagine it also for getting a definition of a built-in symbol, which would point a link to the docs

@felixfbecker I think to have such notifications like window/openBrowser and window/openEditor won't harm, the latter can have parameters like a selection and a cursor position. They are not hard to implement and based on quite stable concepts like URIs and selections, so they won't change.

But we can also consider them like just special cases of window/open notification that just accepts an URI. The tool can decide depending on a given URI what should be done, e.g. if the schema is http(s) open a browser or if the schema is file open an editor. It covers first 2 cases and enables new possibilities.

Consider a tool as a code browser and a server as a database of symbols, so you can click on any element in the editor, get an URI for it, then give it to your colleague and he can open it with a completely another tool for another revision of the file.

We will need special kind of URIs to open symbols in a workspace and inside a file. I think https://github.com/Microsoft/language-server-protocol/issues/77 is about it. The tool should ask servers to convert such URIs to locations and back: https://github.com/Microsoft/language-server-protocol/issues/13. So one server can even ask another to open a symbol via such URIs.

I like the idea of the client deciding how to display the URI. So file:///myfile.php could be in the editor while http://php.net/manual/en/function.array.php would be rendered in a webview. But the URI should not include anything about how it is viewed, it just identifies the resource.

Agree that such a notification makes sense.

Would be a candidate for a proposed protocol extension: https://github.com/Microsoft/language-server-protocol/blob/master/contributing.md

Got added to 3.16

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Khaos66 picture Khaos66  路  5Comments

felixfbecker picture felixfbecker  路  3Comments

angelozerr picture angelozerr  路  6Comments

Wosi picture Wosi  路  6Comments

gorkem picture gorkem  路  6Comments