feat: exclude files from index according to files.exclude
Passing exclude patterns requires support from the language server.pull/437/head
parent
3fdd166950
commit
fd65cf518b
|
@ -63,6 +63,19 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
|||
return
|
||||
}
|
||||
|
||||
// Get excludes from workspace configuration: files.exclude
|
||||
const exclude: string[] = [];
|
||||
const filesConfig = vscode.workspace.getConfiguration('files');
|
||||
const _exclude = filesConfig.get<{[key: string]: boolean}>('exclude', {});
|
||||
for (const key in _exclude) {
|
||||
if (_exclude.hasOwnProperty(key) && _exclude[key]) {
|
||||
// Push the exclude pattern to the array. Note that we want to
|
||||
// match the files under the excluded directory not the
|
||||
// directory itself.
|
||||
exclude.push(key + '/**');
|
||||
}
|
||||
}
|
||||
|
||||
let client: LanguageClient
|
||||
|
||||
const serverOptions = () =>
|
||||
|
@ -123,6 +136,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
|||
// Notify the server about changes to PHP files in the workspace
|
||||
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.php'),
|
||||
},
|
||||
initializationOptions: {
|
||||
exclude,
|
||||
},
|
||||
}
|
||||
|
||||
// Create the language client and start the client.
|
||||
|
|
Loading…
Reference in New Issue