forked from yoctoproject/vscode-bitbake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Remove connection from class members etc
OutputParser and serverNotificationManager don't need to instantiate with connection. The connection can be set on start up. Use Analyzer's uriToAnalyzedDocument for returning document texts to replace documentAsTextMap onDefinitionHandler is in its own file for better testing
- Loading branch information
1 parent
6f63aca
commit 24d9d28
Showing
7 changed files
with
100 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* -------------------------------------------------------------------------------------------- | ||
* Copyright (c) 2023 Savoir-faire Linux. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
* ------------------------------------------------------------------------------------------ */ | ||
|
||
import logger from 'winston' | ||
import { type TextDocumentPositionParams, type Definition } from 'vscode-languageserver/node' | ||
import { analyzer } from '../tree-sitter/analyzer' | ||
import contextHandler from '../ContextHandler' | ||
|
||
export function onDefinitionHandler (textDocumentPositionParams: TextDocumentPositionParams): Definition { | ||
logger.debug(`onDefinition ${JSON.stringify(textDocumentPositionParams)}`) | ||
const documentAsText = analyzer.getDocumentTexts(textDocumentPositionParams.textDocument.uri) | ||
|
||
if (documentAsText === undefined) { | ||
return [] | ||
} | ||
|
||
return contextHandler.getDefinition(textDocumentPositionParams, documentAsText) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters