Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

LSP Inspector #1

Closed
octref opened this issue Jun 26, 2018 · 5 comments
Closed

LSP Inspector #1

octref opened this issue Jun 26, 2018 · 5 comments

Comments

@octref
Copy link
Contributor

octref commented Jun 26, 2018

From @octref on June 4, 2018 9:29

Motivation:

  • Looking at the raw source do not provide certain insights into the behavior of LSP
  • Users have hard time extract useful information from LSP communication and provide that to LSP authors. For example, in this issue the user can only describe the behavior of VS Code. If user's able to provide the data in the LSP, it would be much easier to understand what's going wrong.

Use cases:

  • Teaching users about LSP (Online playground. Left side is monaco, right side is LSP inspector)
  • Extract information from LSP for issue reporting. Let's say an user is having issue running a code action is TypeScript. With the info from LSP inspector, users can give exactly the request/response args in the issue report and make it easier for LS author to debug.
  • Possibly tie to testing together with (https://github.com/octref/vscode-language-server-e2e-test). The inspector could record the LSP communication and generate test cases, for example:
    • LSP inspector records a request and response combo of textDocument/completion
    • Response should contain 1 more item
    • Extension author generates a test case and manually add the missing CompletionItem to the response JSON
    • Extension author now has one more end-to-end test covering the completion case

Current Implementation:

  • Requires modification on language client but not language server.
  • However, if VS Code provides a way to listen/inspect channel contents, or a centralized place to listen to all LSP logs, this inspector could run without any modification to any client/server.

lsp

The UI can be improved, but this just serves as a basis for continued discussion.

Copied from original issue: octref/lsp-inspector#1

@octref
Copy link
Contributor Author

octref commented Jun 26, 2018

From @aeschli on June 4, 2018 19:57

There already is the yourLSPserverID.trace.server option (e.g. json.trace.server) that emits similar information, but I agree that a better presentation would be great.
It would be great to be able to see an overview of calls and let me only expand the once I'm interested in. Better filtering and searching would be great too.

@dbaeumer FYI

@octref
Copy link
Contributor Author

octref commented Jun 26, 2018

From @dbaeumer on June 5, 2018 7:26

As @aeschli pointed out this already exist however only in textual form. It is implemented using the Tracer interface here: https://github.com/Microsoft/vscode-languageserver-node/blob/master/jsonrpc/src/main.ts#L225

Extending this interface that it allows passing on structural information should be quite easy. In addition we would need to allow to plug this tracer which is currently not possible.

But I am open for PRs here.

@octref
Copy link
Contributor Author

octref commented Jun 26, 2018

Yes and that's what I'm using. I think allowing custom tracer would be better, as the channel can also contain other logs.

@octref
Copy link
Contributor Author

octref commented Jun 26, 2018

Progress was made for #2, and demo is here: http://lsp-inspector.surge.sh/

lsp-inspector

@octref
Copy link
Contributor Author

octref commented Jun 26, 2018

From @dbaeumer on June 13, 2018 9:49

Cool!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant