VSCode_LaTeX/src/extension.ts

26 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

2017-12-05 08:54:17 +00:00
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import CompletionItemProvider from './completionItemProvider';
2018-01-07 13:44:53 +00:00
import Commands from './commands';
2017-12-05 08:54:17 +00:00
// 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) {
2018-01-08 14:49:23 +00:00
var outputChannel: vscode.OutputChannel = vscode.window.createOutputChannel("LaTeX build output");
var commands_this_context = { outputChannel: outputChannel, settings: vscode.workspace.getConfiguration('latex') };
2018-01-08 14:49:23 +00:00
2018-01-07 13:44:53 +00:00
// Register Build Commands
// The Command was defined in package.json and the commandId parameter has
// to be equal to the 'command' field in the package.json file
context.subscriptions.push(vscode.commands.registerTextEditorCommand( 'latex.pdflatex', Commands.latex_pdflatex, commands_this_context ));
context.subscriptions.push(vscode.commands.registerTextEditorCommand( 'latex.makeindex', Commands.latex_makeindex, commands_this_context ));
2018-01-07 13:44:53 +00:00
// Register the Completion Item Provider
context.subscriptions.push(vscode.languages.registerCompletionItemProvider(
[{ language: 'latex' }], // document selector
new CompletionItemProvider(), // A Complete Item Provider instance
'\\', '{', '[' //, '=' // Characters to trigger an completion suggestion
));
2017-12-05 08:54:17 +00:00
}