Exclude specific directories from being parsed by intellisense

Viewed 3976

I am using php-intellisense extension for my Visual Studio Code.

How do I exclude other folders from being parsed by this extension? As of now it only excludes node_modules and vendor folder.

2 Answers

The extension does not seem to have any specific setting so, unless I'm missing something, the only way to accomplish that is the files.exclude directive. It should definitively work with all languages because it basically makes the file or directory totally disappear from the program.

Beware though of the consequences: you won't even see the folder in the file explorer, nor will it show in searches.

There is an opened issue on the author's github. I've just added a comment to explain how to workaround it.

Please have a look to my comment: https://github.com/felixfbecker/php-language-server/issues/159#issuecomment-514581602

In brief, you can change the way the workspace files are scanned in this file :

C:\Users\USER\ .vscode\extensions\felixfbecker.php-intellisense-xxxx\vendor\felixfbecker\language-server\src\ Indexer.php

public function index(): Promise
{
    return coroutine(function () {
        // Old code using the rootPath
        //$pattern = Path::makeAbsolute('**/*.php', $this->rootPath);
        // My new pattern 
        $pattern = Path::makeAbsolute('**/*.php', 'C:/Users/[USER]/Projects/sources/app/code');

        $uris = yield $this->filesFinder->find($pattern);
        // ...
    });
}

Restart VS Code after saving the changes and it will only index the needed path.

Related