question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include LSP spec docs next to command definitions (`TEXT_DOCUMENT_DID_OPEN` etc)

See original GitHub issue

I think it’d be nice to include snippets of the official LSP docs next to the command definitions, eg;

TEXT_DOCUMENT_DID_OPEN = 'textDocument/didOpen'
"""
The document open notification is sent from the client to the server to signal
newly opened text documents. The document’s content is now managed by the client
and the server must not try to read the document’s content using the document’s Uri.
Open in this sense means it is managed by the client. It doesn’t necessarily mean
that its content is presented in an editor. An open notification must not be sent
more than once without a corresponding close notification send before. This means
open and close notification must be balanced and the max open count for a particular
textDocument is one. Note that a server’s ability to fulfill requests is independent
of whether a text document is open or closed.

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didOpen
"""

It’s a lot of work, and they’ll relatively easily go out of date. But I wonder if it’s better to include them, even if they do get stale, than to have nothing at all. The URL to the specific paragraph at least has the associated LSP spec version.

It’s also worth noting the docs can’t really be copied wholesale, because Pygls hides a lot of implementation details that Pygls users should not be concerned with. And hence a bit of curation is needed when adding the relevant docs to Pygls.

It looks like we’ll get equivalent documentation for types automatically when lsprotocol support is merged (#264). So that’ll cover that side of the spec.

What are you thoughts? Is this the best place to put the command docs? Is the only sticking point the sheer grunt work of adding and maintaining them?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
alcarneycommented, Oct 16, 2022

Ah right, you’re talking about taking the comments (those which this issue is proposing to write)

Ah, sorry I misunderstood 😃

0reactions
tombhcommented, Oct 16, 2022

Ah right, you’re talking about taking the comments (those which this issue is proposing to write) being copied to the website docs? Yes, that’s a great idea too.

I thought you might have meant that Sphinx could somehow parse the LSP spec docs and automatically update the Pygls comments/docs from them. But I’m not even sure any tool could do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Server Protocol Specification - 3.17
This document describes the 3.17.x version of the language server protocol. An implementation for node of the 3.17.x version of the protocol can...
Read more >
Advanced Usage — pygls documentation - Read the Docs
Commands ¶. Commands can be treated as a custom features, i.e. everything that is not covered by LSP specification, but needs to be...
Read more >
lsp-mode/lsp-mode.el at master · emacs-lsp/lsp-mode - GitHub
URL: https://github.com/emacs-lsp/lsp-mode. ;; This program is free software; you can redistribute it and/or modify. ;; it under the terms of the GNU ...
Read more >
lsp_types - Rust - Docs.rs
Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be hierarchical and they have two ...
Read more >
Language Server Extension Guide - Visual Studio Code
> git clone https://github.com/microsoft/vscode-extension-samples.git > cd vscode-extension-samples/lsp-sample > npm install > npm run compile > code . The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found