-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,52 @@ | ||
'use strict'; | ||
'use strict'; | ||
|
||
import * as vscode from 'vscode'; | ||
import * as vscode from 'vscode'; | ||
|
||
export function activate(context: vscode.ExtensionContext) { | ||
console.log('Congratulations, your extension "without-guns" is now active!'); | ||
export function activate(context: vscode.ExtensionContext) { | ||
const intelliSenseSettings = new IntelliSenseSettings(vscode.workspace.getConfiguration()) | ||
|
||
let disposable = vscode.commands.registerCommand('withoutGuns.gunsOff', () => { | ||
vscode.window.showInformationMessage('Your guns are turned off ;-)'); | ||
}); | ||
let gunsOff = vscode.commands.registerCommand('withoutGuns.gunsOff', () => { | ||
vscode.window.showInformationMessage('Your guns are turned off ;-)'); | ||
intelliSenseSettings.removeIntelliSense(); | ||
}); | ||
|
||
context.subscriptions.push(disposable); | ||
let gunsOn = vscode.commands.registerCommand('withoutGuns.gunsOn', () => { | ||
vscode.window.showInformationMessage('Your guns are turned on.'); | ||
intelliSenseSettings.applyInitialSettings(); | ||
}); | ||
|
||
context.subscriptions.push(gunsOff); | ||
context.subscriptions.push(gunsOn); | ||
} | ||
|
||
class IntelliSenseSettings { | ||
private readonly configuration : vscode.WorkspaceConfiguration; | ||
|
||
private readonly initialQuickSuggestions : boolean; | ||
private readonly initialWordBasedSuggestions : boolean; | ||
private readonly initialParameterHints : boolean; | ||
private readonly initialsuggestOnTriggerCharacters : boolean; | ||
|
||
constructor(configuration : vscode.WorkspaceConfiguration) { | ||
this.configuration = configuration; | ||
|
||
this.initialQuickSuggestions = configuration.get("editor.quickSuggestions"); | ||
this.initialWordBasedSuggestions = configuration.get("editor.wordBasedSuggestions"); | ||
this.initialParameterHints = configuration.get("editor.parameterHints"); | ||
this.initialsuggestOnTriggerCharacters = configuration.get("editor.suggestOnTriggerCharacters"); | ||
} | ||
|
||
applyInitialSettings() { | ||
this.configuration.update("editor.quickSuggestions", this.initialQuickSuggestions); | ||
this.configuration.update("editor.wordBasedSuggestions", this.initialWordBasedSuggestions); | ||
this.configuration.update("editor.parameterHints", this.initialParameterHints); | ||
this.configuration.update("editor.suggestOnTriggerCharacters", this.initialsuggestOnTriggerCharacters); | ||
} | ||
|
||
removeIntelliSense() { | ||
this.configuration.update("editor.quickSuggestions", false); | ||
this.configuration.update("editor.wordBasedSuggestions", false); | ||
this.configuration.update("editor.parameterHints", false); | ||
this.configuration.update("editor.suggestOnTriggerCharacters", false); | ||
} | ||
} |