feat(lsp): leave the extension verdicts to the registry
Diagnostics no longer repeat the generated table's ignorance of a registered mnemonic: unknown-instruction and unencodable-instruction against a statement the registry encodes are filtered from the server's own presentation, driven by asm.LookupExtension directly. The filter is a no-op once lint learns the registry, so the two compose unchanged. Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
dadeda144a
commit
2d803e38d8
3 files changed
+116
No files matched your search
@@ -1127,6 +1127,13 @@ func (s *Server) diagnosticsFor(uri string) []Diagnostic {
|
||||
cfg := lint.Config{Arch: arch.FromFilename(uriPath(uri))}
|
||||
diags := lint.File(f, cfg)
|
||||
|
||||
// The extension layer owns the verdict on its own mnemonics: the registry
|
||||
// encodes them, so a report of unknown or unencodable against a
|
||||
// registered mnemonic is the generated table's ignorance, not the file's
|
||||
// defect. The filter consults the registry directly and is a no-op once
|
||||
// lint learns the registry itself, so the two compose unchanged.
|
||||
owned := extensionMnemonicSites(f, cfg.Arch)
|
||||
|
||||
out := make([]Diagnostic, 0, len(diags)+len(errs))
|
||||
for _, e := range errs {
|
||||
pos := token.Position{Line: 1, Column: 1}
|
||||
@@ -1142,6 +1149,9 @@ func (s *Server) diagnosticsFor(uri string) []Diagnostic {
|
||||
})
|
||||
}
|
||||
for _, d := range diags {
|
||||
if extOwnedCode(d.Code) && owned[[2]int{d.Pos.Line, d.Pos.Column}] {
|
||||
continue
|
||||
}
|
||||
out = append(out, Diagnostic{
|
||||
Range: clientRange(text, toRange(d.Pos.Line, d.Pos.Column, d.End)),
|
||||
Severity: lintSeverity(d.Severity),
|
||||
|
||||
Reference in new issue
Block a user