Surface warnings to frontend and LSP (#4603)

* Send multiple errors and warnings to the frontend and LSP

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Refactor the parser to use CompilationError for parsing errors rather than KclError

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Refactoring: move CompilationError, etc.

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Integrate compilation errors with the frontend and CodeMirror

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Fix tests

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Review comments

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Fix module id/source range stuff

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* More test fixups

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2024-12-06 13:57:31 +13:00
committed by GitHub
parent 513c76ecc8
commit eb96d6539c
76 changed files with 1461 additions and 3139 deletions

View File

@ -16,6 +16,7 @@ import {
sketchFromKclValue,
sketchFromKclValueOptional,
SourceRange,
sourceRangeFromRust,
SyntaxType,
VariableDeclaration,
VariableDeclarator,
@ -669,7 +670,7 @@ export function isNodeSafeToReplacePath(
export function isNodeSafeToReplace(
ast: Node<Program>,
sourceRange: [number, number]
sourceRange: SourceRange
):
| {
isSafe: boolean
@ -821,7 +822,7 @@ export function isLinesParallelAndConstrained(
return {
isParallelAndConstrained,
selection: {
codeRef: codeRefFromRange(prevSourceRange, ast),
codeRef: codeRefFromRange(sourceRangeFromRust(prevSourceRange), ast),
artifact: artifactGraph.get(prevSegment.__geoMeta.id),
},
}
@ -957,7 +958,8 @@ export function findUsesOfTagInPipe(
return
const tagArgValue =
tagArg.type === 'TagDeclarator' ? String(tagArg.value) : tagArg.name
if (tagArgValue === tag) dependentRanges.push([node.start, node.end])
if (tagArgValue === tag)
dependentRanges.push([node.start, node.end, true])
},
})
return dependentRanges