[minor] Adds some docs to the LSP interface #36740
Conversation
…lerOptionsDiagnostic is
| getProgramDiagnostics(): Diagnostic[] { | ||
| return this.getCompilerOptionsDiagnostics(); | ||
| } | ||
|
|
There was a problem hiding this comment.
This is the only thing which isn't JSDoc improvements, it fixed a TODO item I agreed with:
// TODO: Rename this to getProgramDiagnostics to better indicate that these are any /**
// diagnostics present for the program level, and not just 'options' diagnostics.
There was a problem hiding this comment.
I assume this means “diagnostics not related to any particular source file”? My first thought when I saw getProgramDiagnostics was that it included all diagnostics for the program, including file-specific ones, since a Program is fundamentally a collection of files and options. If my assumption about what these diagnostics really are (which should be double-checked) is correct, I think getGlobalDiagnostics would have better conveyed the meaning to me. If this is going to be the canonical public API going forward though, I think it’d be good to get a consensus on the name beyond just the two of us (and whoever wrote that TODO).
andrewbranch
left a comment
There was a problem hiding this comment.
- Copy edits ✍️
- Let’s clarify
getProgramDiagnosticsand bikeshed the name with at least one or two others on the team 🚲🏚
| // @ts-ignore - 'getProgramDiagnostics' is declared but its value is never read - this is because it is a dupe of getCompilerOptionsDiagnostics | ||
| // so that the external interface makes more sense. | ||
| function getProgramDiagnostics() { | ||
| return getCompilerOptionsDiagnostics(); | ||
| } |
There was a problem hiding this comment.
I don’t understand why this can’t just be deleted—removing it wouldn’t change the public API, right?
| getProgramDiagnostics(): Diagnostic[] { | ||
| return this.getCompilerOptionsDiagnostics(); | ||
| } | ||
|
|
There was a problem hiding this comment.
I assume this means “diagnostics not related to any particular source file”? My first thought when I saw getProgramDiagnostics was that it included all diagnostics for the program, including file-specific ones, since a Program is fundamentally a collection of files and options. If my assumption about what these diagnostics really are (which should be double-checked) is correct, I think getGlobalDiagnostics would have better conveyed the meaning to me. If this is going to be the canonical public API going forward though, I think it’d be good to get a consensus on the name beyond just the two of us (and whoever wrote that TODO).
|
|
||
| /** | ||
| * Gets semantic information about the identifier at a particular position in a | ||
| * file. Quick info is what you typically see when you hover in an editor. |
Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>
|
I've pulled the |
This is mainly to improve the understandability of using the LSP, it's not complete but it's movement.