fix definition provider

This commit is contained in:
2025-04-05 10:12:48 -07:00
parent 0477ee397f
commit 8c983dd571
2 changed files with 8 additions and 2 deletions

View File

@@ -128,7 +128,12 @@ export function activate(context: vscode.ExtensionContext) {
console.log(`entry ${name} not found`); console.log(`entry ${name} not found`);
return null; return null;
} }
let uri = vscode.Uri.file(entry.fc.file); const root = vscode.workspace.getWorkspaceFolder(document.uri);
if (!root) {
console.error("Workspace folder not found");
return null;
}
let uri = vscode.Uri.file(path.join(root.uri.fsPath, entry.fc.file));
let start = new vscode.Position(entry.fc.line, entry.fc.col); let start = new vscode.Position(entry.fc.line, entry.fc.col);
let range = new vscode.Range(start, start); let range = new vscode.Range(start, start);
return new vscode.Location(uri, range); return new vscode.Location(uri, range);

View File

@@ -27,7 +27,8 @@ primNS = ("Prim" :: Nil)
jsonTopContext : M Json jsonTopContext : M Json
jsonTopContext = do jsonTopContext = do
top <- getTop top <- getTop
pure $ JsonObj (("context", JsonArray (map jsonDef $ listValues top.defs)) :: Nil) let defs = join $ map (\mod => listValues mod.modDefs) $ listValues top.modules
pure $ JsonObj (("context", JsonArray (map jsonDef $ defs)) :: Nil)
where where
jsonDef : TopEntry -> Json jsonDef : TopEntry -> Json
-- There is no FC here... -- There is no FC here...