From a9fb66b381f4de6878880adef60b778d5d2fc416 Mon Sep 17 00:00:00 2001 From: HO-COOH <42881734+HO-COOH@users.noreply.github.com> Date: Wed, 14 Apr 2021 12:50:20 -0500 Subject: Doxygen command intellisense support (#211) * Nicer setting descriptions * Initial support for doxygen command completion * Remove commented function * Initial support for doxygen command completion * Remove commented function * Fix multi-line doxygen indentation * Doxygen documentation -> markdown, add gif, update readme --- src/extension.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/extension.ts') diff --git a/src/extension.ts b/src/extension.ts index 3329ee4..b7c148c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3,6 +3,7 @@ // Import the module and reference it with the alias vscode in your code below import * as vscode from "vscode"; import CodeParserController from "./CodeParserController"; +import DoxygenCompletionItemProvider from "./DoxygenCompletionItemProvider"; enum Version { CURRENT = "1.1.0", @@ -12,7 +13,9 @@ enum Version { // this method is called when your extension is activated // your extension is activated the very first time the command is executed -export function activate(context: vscode.ExtensionContext) { +export function activate(context: vscode.ExtensionContext) +{ + const parser = new CodeParserController(); context.subscriptions.push(parser); @@ -23,4 +26,17 @@ export function activate(context: vscode.ExtensionContext) { } else if (version !== Version.CURRENT) { context.globalState.update(Version.KEY, Version.CURRENT); } + + /*register doxygen commands intellisense */ + if (vscode.workspace.getConfiguration("doxdocgen.generic").get("commandSuggestion")) + vscode.languages.registerCompletionItemProvider({ language: "cpp", scheme: "file" }, new DoxygenCompletionItemProvider(), "@", "\\"); + + //After the CompletionItemProvider is registered, it cannot be unregistered + //Check the settings everytime when it is triggered would be inefficient + //So just prompt the user to restart to take effect + vscode.workspace.onDidChangeConfiguration(event => + { + if (event.affectsConfiguration("doxdocgen.generic.commandSuggestion")) + vscode.window.showWarningMessage("Please restart vscode to apply the changes!"); + }); } -- cgit v1.2.3