Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement opt out config option for ref count code lens #837

Merged
merged 1 commit into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@
"trace.server": "off"
}
},
"terraform.enableReferenceCountCodeLens": {
"scope": "resource",
"type": "boolean",
"default": true,
"description": "Display reference counts above top level blocks and attributes."
},
"terraform-ls.rootModules": {
"scope": "resource",
"type": "array",
Expand Down
7 changes: 6 additions & 1 deletion src/clientHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class ClientHandler {
let terraformExecTimeout: string;
let terraformLogFilePath: string;
let excludeModulePaths: string[];
let enableReferenceCountCodeLens: boolean;
let documentSelector: DocumentSelector;
let outputChannel: vscode.OutputChannel;
if (location) {
Expand All @@ -127,6 +128,7 @@ export class ClientHandler {
terraformLogFilePath = config('terraform-ls', wsFolder).get('terraformLogFilePath');
rootModulePaths = config('terraform-ls', wsFolder).get('rootModules');
excludeModulePaths = config('terraform-ls', wsFolder).get('excludeRootModules');
enableReferenceCountCodeLens = config('terraform', wsFolder).get('enableReferenceCountCodeLens');
outputChannel = vscode.window.createOutputChannel(channelName);
outputChannel.appendLine(`Launching language server: ${cmd} ${serverArgs.join(' ')} for folder: ${location}`);
} else {
Expand All @@ -139,6 +141,7 @@ export class ClientHandler {
terraformLogFilePath = config('terraform-ls').get('terraformLogFilePath');
rootModulePaths = config('terraform-ls').get('rootModules');
excludeModulePaths = config('terraform-ls').get('excludeRootModules');
enableReferenceCountCodeLens = config('terraform').get('enableReferenceCountCodeLens');
outputChannel = vscode.window.createOutputChannel(channelName);
outputChannel.appendLine(`Launching language server: ${cmd} ${serverArgs.join(' ')}`);
}
Expand Down Expand Up @@ -190,7 +193,9 @@ export class ClientHandler {

const client = new LanguageClient(id, name, serverOptions, clientOptions);

client.registerFeature(new ShowReferencesFeature(client));
if (enableReferenceCountCodeLens) {
client.registerFeature(new ShowReferencesFeature(client));
}

client.onDidChangeState((event) => {
if (event.newState === State.Stopped) {
Expand Down