diff --git a/phpcs/src/extension.ts b/phpcs/src/extension.ts index 789217e..2a30354 100644 --- a/phpcs/src/extension.ts +++ b/phpcs/src/extension.ts @@ -52,13 +52,26 @@ export function activate(context: ExtensionContext) { } }; + // Notify the server about file changes to 'ruleset.xml' files contain in the workspace + const watchedFiles: string[] = [ + ".phpcs.xml", + ".phpcs.xml.dist", + "phpcs.xml", + "phpcs.xml.dist", + "phpcs.ruleset.xml", + "ruleset.xml", + ]; + + const fileEvents = watchedFiles.map(file => workspace.createFileSystemWatcher(`**/${file}`)); + + context.subscriptions.push(...fileEvents); + // Options to control the language client let clientOptions: LanguageClientOptions = { // Register the server for php documents documentSelector: ["php"], synchronize: { - // Notify the server about file changes to 'ruleset.xml' files contain in the workspace - fileEvents: workspace.createFileSystemWatcher("**/ruleset.xml") + fileEvents }, middleware: middleware as Middleware };