microsoft / microsoft/language-server-protocol
How to have a diagnostic WITHOUT associated file?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13k
- Forks
- 1k
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 10
Description
Imagine you compile a C# program without a 'main' entrypoint, and it generates the error message
CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/Users/ljw/code/c/c.csproj]
It's impossible to report this error via LSP! That's because the publishDiagnostics message has a mandatory uri field -- but for errors like this, there's no uri that would make sense! And so the C# plugin for VSCode shows this message in the build output window, but simply doesn't report this error at all to VSCode diagnostics list. @DustinCampbell
I experimented with VSCode behavior:
publishDiagnostics with uri = null-- this doesn't get shown in the diagnostics window at allpublishDiagnostics with uri = ""-- this sometimes pops up the Chrome debugger in VSCode, and sometimes crashes VSCode completely with a "report this crash to Apple" system dialog.publishDiagnostics with uri = "file:///"oruri = "file:///some/directory-- this shows the error in the diagnostics window, and when you click on it, VSCode does some frenetic flickering of a new document tab before closing it again.
I think that "diagnostics not related to a particular file" are a real fact of life. LSP should be extended to cope with them. And VSCode should too.
My proposal: make the uri field optional. If it is absent/null, then treat it as a file-less diagnostic, and the range field inside each individual Diagnostic will be ignored.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the publishDiagnostics message and the Diagnostic.range field described in the issue, then review the 21-comment discussion for protocol and client constraints. Done means the protocol clearly defines how diagnostics without an associated file are represented and how their ranges are handled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, vscode
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100