mirror of
https://github.com/danog/code-server.git
synced 2024-12-15 18:57:11 +01:00
be3e823608
git-subtree-dir: lib/vscode git-subtree-split: e5a624b788d92b8d34d1392e4c4d9789406efe8f
55 lines
2.2 KiB
TypeScript
55 lines
2.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as vscode from 'vscode';
|
|
|
|
import PHPCompletionItemProvider from './features/completionItemProvider';
|
|
import PHPHoverProvider from './features/hoverProvider';
|
|
import PHPSignatureHelpProvider from './features/signatureHelpProvider';
|
|
import PHPValidationProvider from './features/validationProvider';
|
|
|
|
export function activate(context: vscode.ExtensionContext): any {
|
|
|
|
let validator = new PHPValidationProvider(context.workspaceState);
|
|
validator.activate(context.subscriptions);
|
|
|
|
// add providers
|
|
context.subscriptions.push(vscode.languages.registerCompletionItemProvider('php', new PHPCompletionItemProvider(), '>', '$'));
|
|
context.subscriptions.push(vscode.languages.registerHoverProvider('php', new PHPHoverProvider()));
|
|
context.subscriptions.push(vscode.languages.registerSignatureHelpProvider('php', new PHPSignatureHelpProvider(), '(', ','));
|
|
|
|
// need to set in the extension host as well as the completion provider uses it.
|
|
vscode.languages.setLanguageConfiguration('php', {
|
|
wordPattern: /(-?\d*\.\d\w*)|([^\-\`\~\!\@\#\%\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
|
onEnterRules: [
|
|
{
|
|
// e.g. /** | */
|
|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
|
afterText: /^\s*\*\/$/,
|
|
action: { indentAction: vscode.IndentAction.IndentOutdent, appendText: ' * ' }
|
|
},
|
|
{
|
|
// e.g. /** ...|
|
|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
|
action: { indentAction: vscode.IndentAction.None, appendText: ' * ' }
|
|
},
|
|
{
|
|
// e.g. * ...|
|
|
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
|
action: { indentAction: vscode.IndentAction.None, appendText: '* ' }
|
|
},
|
|
{
|
|
// e.g. */|
|
|
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
|
|
action: { indentAction: vscode.IndentAction.None, removeText: 1 }
|
|
},
|
|
{
|
|
// e.g. *-----*/|
|
|
beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/,
|
|
action: { indentAction: vscode.IndentAction.None, removeText: 1 }
|
|
}
|
|
]
|
|
});
|
|
} |