从智能感知中排除特定目录

时间:2018-08-31 04:59:04

标签: visual-studio-code intellisense

我在Visual Studio代码中使用php-intellisense扩展名。

如何排除此扩展程序无法解析其他文件夹?到目前为止,它仅排除node_modulesvendor文件夹。

2 个答案:

答案 0 :(得分:1)

该扩展名似乎没有任何特定的设置,因此,除非我缺少某些内容,否则唯一的实现方法是files.exclude指令。它应该绝对适用于所有语言,因为它基本上使文件或目录从程序中完全消失。

请注意后果:您甚至不会在文件浏览器中看到该文件夹​​,也不会在搜索中显示该文件夹。

答案 1 :(得分:0)

作者的github上有一个未解决的问题。我刚刚添加了一条评论,以说明如何解决该问题。

请查看我的评论:https://github.com/felixfbecker/php-language-server/issues/159#issuecomment-514581602

简而言之,您可以更改在此文件中扫描工作区文件的方式:

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);
        // ...
    });
}

保存更改后重新启动VS Code,它将仅索引所需的路径。

相关问题