Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: fix
packages:
- "@typespec/compiler"
---

Compiler internal decorators shouldn't be listed in autocomplete
11 changes: 11 additions & 0 deletions packages/compiler/src/server/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,17 @@ async function addIdentifierCompletion(
kind,
};

// skip indexer/docFromComment functions under TypeSpec namespace
// these are internal only functions(decorators) that should not be exposed to users
if (
(item.label === "indexer" || item.label === "docFromComment") &&
item.kind === CompletionItemKind.Function &&
sym.parent?.name === "TypeSpec" &&
item.documentation === undefined
) {
continue;
}

if (sym.name.startsWith("$")) {
const targetNode = getSourceLocation(node);
const lineAndChar = targetNode.file.getLineAndCharacterOfPosition(node.pos);
Expand Down
Loading