feat(lsp): offer and document the registered extended mnemonics
Completion merges the extension registry's mnemonics beside the toolchain entries, with operand shapes measured against the layer's own encoder, and hover documents a registered mnemonic from its metadata: the extension notice, the forms, the features, the fixed encodings and the manual references. Assisted-by: GLM 5.3 Flash
This commit is contained in:
1 parent
a90ec84bee
commit
dadeda144a
3 files changed
+644
No files matched your search
@@ -114,6 +114,9 @@ func (s *Server) completion(p completionParams) []CompletionItem {
|
||||
}
|
||||
items = append(items, CompletionItem{Label: r.Name, Kind: kind, Detail: r.Desc})
|
||||
}
|
||||
// The extended-instruction layer, beside the toolchain entries: the
|
||||
// registered mnemonics with the operand shapes the registry accepts.
|
||||
items = applyExtensionCompletion(items, a.Arch)
|
||||
// Local labels defined in the document.
|
||||
if f, _ := parser.Parse("", s.docs[p.TextDocument.URI]); f != nil {
|
||||
for _, name := range labelNames(f) {
|
||||
@@ -134,6 +137,7 @@ func (s *Server) hover(p hoverParams) *Hover {
|
||||
a := arch.ForArch(arch.FromFilename(uriPath(p.TextDocument.URI)))
|
||||
|
||||
var md string
|
||||
ext := extensionHover(a.Arch, word)
|
||||
// Directives first: several of their names (TEXT, PCALIGN, FUNCDATA,
|
||||
// the BYTE family) also sit in the generated instruction tables with
|
||||
// empty summaries, and the directive documentation is the answer a
|
||||
@@ -142,6 +146,13 @@ func (s *Server) hover(p hoverParams) *Hover {
|
||||
md = doc
|
||||
} else if in, ok := a.Lookup(word); ok {
|
||||
md = "**" + in.Name + "**: " + in.Summary
|
||||
// A mnemonic the extension layer registers documents its registered
|
||||
// forms beside the table entry.
|
||||
if ext != "" {
|
||||
md += "\n\n" + ext
|
||||
}
|
||||
} else if ext != "" {
|
||||
md = ext
|
||||
} else if r, ok := a.Register(word); ok {
|
||||
md = "**" + r.Name + "**: " + r.Class.String() + " register. " + r.Desc
|
||||
} else if desc, ok := arch.PseudoRegDesc(word); ok {
|
||||
|
||||
Reference in new issue
Block a user