microsoft/vscode-extension-samples

lsp-sample does not work

hak33m16 opened this issue · 3 comments

Extension sample

lsp-sample

VS Code version

1.92.0

What went wrong?

The autocomplete and analysis that's supposed to be provided by the lsp-sample extension does not work

If you follow the instructions outlined in the README

  • There are no such autocomplete options available on a brand new plain text document in the Extension Development Host window
  • Entering text content does not emit any diagnostics

Here you can see it built perfectly fine, and in a brand new plain text document I have no autocomplete options:
Screenshot 2024-08-03 152018

VSCode: 1.92.0
Node: v22.5.1
npm: 10.8.2
Windows 11:

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      22631  0

Works for me.

Image

Please note the code completion and errors are generated for plain txt files only that exist on disk. See https://github.com/microsoft/vscode-extension-samples/blob/main/lsp-sample/client/src/extension.ts#L37

So it doesn't work for untitled files.

Please note the code completion and errors are generated for plain txt files only that exist on disk

Interesting, it does appear to work if I save the file to disk. That's unexpected behavior in my opinion, given that the format in the bottom right of a new untitled file that's yet to be saved is "plaintext". Thanks for clarifying

@hak33m16 you can provide support for unsaved files as well. Simple define a document selector that includes a filter with the untitled scheme or with a * scheme.