Skip to content

Exclude from index #1569

Closed
Closed

Description

@infectos

I need to exclude some directories from indexing.
For example I have _docker-infrastructure directory that I don't want to index at all. And all its sub-directories too. Because I don't have permissions in some files inside, but that is another story.
Inside my project I have the .phpactor.json file

{
    "indexer.exclude_patterns": [
            "\/vendor\/**\/Tests\/**\/*",
            "\/vendor\/**\/tests\/**\/*",
            "\/vendor\/composer\/**\/*",
            "\/_docker-infrastructure\/**"
    ],

    "logging.enabled": true,
    "logging.path": "phpactor.log",
    "logging.level": "warning",
    "logging.formatter": "pretty"
    
}

Unfortunately, it doesn't work. I still got the error when lsp starts.

LSP[phpactor] Error in service "indexer" "Phpactor\Extension\LanguageServerIndexer\Handler\IndexerHandler:Phpactor\LanguageServer\
Core\Service\{closure}": RecursiveDirectoryIterator::__construct(/home/myname/backend/_docker-infrastructure/do
cker/.data/postgres): Failed to open directory: Permission denied

I am not experienced with glob and it might be the wrong glob pattern.

Activity

  1. KasparRosin commented on May 11, 2022

    @KasparRosin

    I think you need to have it like this, to exclude the files recursively inside _docker-infrastructure
    "\/_docker-infrastructure\/**\/*"

  2. infectos commented on May 11, 2022

    @infectos
    Author

    I think you need to have it like this, to exclude the files recursively inside _docker-infrastructure "\/_docker-infrastructure\/**\/*"

    It doesn't work too

  3. added 2 commits that reference this issue on May 12, 2022
  4. dantleech commented on May 12, 2022

    @dantleech
    Collaborator

    the filtering happens after accessing the file, i've updated to ignore these errors in #1576 should be fine ...

  5. added 2 commits that reference this issue on May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions