-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] Add helpful messages for invalid expression diagnostics #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2301c95
47652a0
7d1efbf
873b950
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,7 +37,13 @@ import { | |||||||||
| iterateTokens | ||||||||||
| } from './ls-utils'; | ||||||||||
| import { pathVariableCompletions, tryVariableHoverUsingSpans } from './variable-utils'; | ||||||||||
| import { getDiagnosticsForDocument } from './diagnostics'; | ||||||||||
| import { | ||||||||||
| getDiagnosticsForDocument, | ||||||||||
| createDiagnosticFromParseError, | ||||||||||
| createDiagnosticFromError, | ||||||||||
| TokenSpan | ||||||||||
| } from './diagnostics'; | ||||||||||
| import { ParseError } from '../types/errors'; | ||||||||||
|
|
||||||||||
| export function createLanguageService(options: LanguageServiceOptions | undefined = undefined): LanguageServiceApi { | ||||||||||
| // Build a parser instance to access keywords/operators/functions/consts | ||||||||||
|
|
@@ -299,22 +305,54 @@ export function createLanguageService(options: LanguageServiceOptions | undefine | |||||||||
|
|
||||||||||
| /** | ||||||||||
| * Analyzes the document for function calls and checks if they have the correct number of arguments. | ||||||||||
| * Returns diagnostics for function calls with incorrect argument counts. | ||||||||||
| * Returns diagnostics for function calls with incorrect argument counts, as well as | ||||||||||
| * syntax errors detected by the parser (unclosed strings, brackets, unknown characters, etc.). | ||||||||||
|
||||||||||
| * syntax errors detected by the parser (unclosed strings, brackets, unknown characters, etc.). | |
| * syntax errors detected by the parser (unclosed strings, brackets, unknown characters, etc.). | |
| * If tokenization fails due to syntax errors, only syntax-error diagnostics are returned and | |
| * function argument checking is skipped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
TokenSpantype is being imported from the diagnostics module, but it's only used internally withingetDiagnosticsandgetDiagnosticsForDocument. Consider whether this export is necessary at the language-service module level, as it increases the API surface area without clear external usage.