diff options
author | bscan <10503608+bscan@users.noreply.github.com> | 2023-01-16 18:52:34 -0500 |
---|---|---|
committer | bscan <10503608+bscan@users.noreply.github.com> | 2023-01-16 18:52:34 -0500 |
commit | bf2cd43067549f1164be444424a77f75002bd187 (patch) | |
tree | 9b290c77ac77a40b24e687115a404cd1ed9af7c4 /browser-ext | |
parent | 11bf9612cbf3ca79275eb2279c78d3a8182940a3 (diff) | |
download | PerlNavigator-bf2cd43067549f1164be444424a77f75002bd187.zip |
Tagging issue caused web extension to throw errors. cleaning up logging as well
Diffstat (limited to 'browser-ext')
-rw-r--r-- | browser-ext/src/browserServerMain.ts | 10 | ||||
-rw-r--r-- | browser-ext/src/web-navigation.ts | 4 | ||||
-rw-r--r-- | browser-ext/src/web-parse.ts | 4 |
3 files changed, 5 insertions, 13 deletions
diff --git a/browser-ext/src/browserServerMain.ts b/browser-ext/src/browserServerMain.ts index c9b4c4f..55e328d 100644 --- a/browser-ext/src/browserServerMain.ts +++ b/browser-ext/src/browserServerMain.ts @@ -82,7 +82,7 @@ documents.onDidChangeContent(change => { async function validatePerlDocument(textDocument: TextDocument): Promise<void> { - console.log("Rebuilding symbols for " + textDocument.uri + ""); + // console.log("Rebuilding symbols for " + textDocument.uri + ""); const perlDoc = await buildNav(textDocument); navSymbols.set(textDocument.uri, perlDoc); return; @@ -91,13 +91,11 @@ async function validatePerlDocument(textDocument: TextDocument): Promise<void> { connection.onDocumentSymbol(params => { - console.log("Navigator: Getting document symbols"); return getSymbols(navSymbols, params.textDocument.uri); }); // This handler provides the initial list of the completion items. connection.onCompletion((params: TextDocumentPositionParams): CompletionList | undefined => { - console.log("Navigator: Getting completion results"); let document = documents.get(params.textDocument.uri); let perlDoc = navSymbols.get(params.textDocument.uri); @@ -113,8 +111,6 @@ connection.onCompletion((params: TextDocumentPositionParams): CompletionList | u connection.onHover(params => { - console.log("Trying to hover"); - console.log(params.position); let document = documents.get(params.textDocument.uri); let perlDoc = navSymbols.get(params.textDocument.uri); if(!document || !perlDoc) return; @@ -124,14 +120,10 @@ connection.onHover(params => { connection.onDefinition(params => { - console.log("Navigator: Getting definition results"); - let document = documents.get(params.textDocument.uri); let perlDoc = navSymbols.get(params.textDocument.uri); if(!document || !perlDoc) return; let locOut: Location | Location[] | undefined = getDefinition(params, perlDoc, document); - console.log("Got definition results"); - console.log(locOut); return locOut; }); diff --git a/browser-ext/src/web-navigation.ts b/browser-ext/src/web-navigation.ts index 1f27f44..960d9f3 100644 --- a/browser-ext/src/web-navigation.ts +++ b/browser-ext/src/web-navigation.ts @@ -15,16 +15,14 @@ export function getDefinition(params: DefinitionParams, perlDoc: PerlDocument, t let position = params.position const symbol = getSymbol(position, txtDoc); - console.log("Trying to get defintion for symbol: " + symbol); + if(!symbol) return; const foundElems = lookupSymbol(perlDoc, symbol, position.line); - console.log("Found elements" + foundElems.length); if(foundElems.length == 0){ return; } - console.log("Still here"); let locationsFound: Location[] = []; diff --git a/browser-ext/src/web-parse.ts b/browser-ext/src/web-parse.ts index d7cb903..867ff07 100644 --- a/browser-ext/src/web-parse.ts +++ b/browser-ext/src/web-parse.ts @@ -24,6 +24,8 @@ export async function buildNav(textDocument: TextDocument): Promise<PerlDocument function MakeElem(name: string, type: PerlSymbolKind | 'u' | '1' | '2', typeDetail: string, file: string, pack:string, line:number, perlDoc: PerlDocument) : void{ + if(!name) return; // Don't store empty names (shouldn't happen) + if (type == '1'){ // This object is only intended as the canonicalLookup, not for anything else. return; @@ -122,7 +124,7 @@ function buildPlTags(textDocument: TextDocument, perlDoc: PerlDocument) { if (match[1]) { MakeElem(match[1], PerlSymbolKind.Label, '', file, package_name, line_number, perlDoc); } - MakeElem(match[1], PerlSymbolKind.LocalVar, '', file, package_name, line_number, perlDoc); + MakeElem(match[2], PerlSymbolKind.LocalVar, '', file, package_name, line_number, perlDoc); } // Lexical match variables if(my ($foo, $bar) ~= ). Optional to detect (my $newstring = $oldstring) =~ s/foo/bar/g; |