-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #8669: .gitignore entries shouldn't be excluded from workspaceContains events #8671
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vnfedotov thank you for your investigation into the issue and your subsequent pull-request contribution 👍 Please be sure to complete the Eclipse Contributor Agreement (ECA) so we can accept your changes.
Signed-off-by: Vladimir Fedotov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vnfedotov were you able to confirm the behavior in vscode, I do not believe they search in ignored files when determining the activation event for workspaceContains
. I verified with a custom extension which displays a message when compile_commands.json
is present in the workspace.
During my tests in vscode, I noticed that the compile_commands.json added under node_modules
(which is gitignored) does not trigger the activation event, while if it outside gitnignored files it does. This is the behavior I expect since I do not believe gitignored files should trigger extensions eagerly.
@vince-fugnitto I did. I've tested with vscode-clangd extension (https://github.com/clangd/vscode-clangd) modified to have following activationEvents:
In fact, underlying workspace.findFiles() behaves differently in vscode, which initially made me think in has something to do with #6460 -- in vscode it finds gitignored files, in theia it doesn't (because useGitIgnore is true by default). P.S. It's probably easier to test with vscode-clangd. If you're seeing prompt to install clangd, it means it's activated. |
@vnfedotov when testing, did you add a To test, I created a minimal extension with the following activation event: "activationEvents": [
"workspaceContains:**/compile_commands.json"
], Upon activation it will display an information message to end-users (for test purposes). The two use case are:
For test purposes, you can use the sources of the extension itself: https://github.com/vince-fugnitto/workspace-contains-test
|
@vnfedotov I believe the fix would not be to ignore all gitignored files, but rather parent ones which seem to be your initial bug:
|
@vince-fugnitto These are ripgrep args that I've extracted from vscode:
You can probably guess why workspaceContains doesn't fire when compile_commands.json is placed in node_modules.
|
@vnfedotov I understand that vscode does not activate the extension when it is under |
@vince-fugnitto The point I was trying to make is that |
@vnfedotov I placed a |
@vince-fugnitto I'm not sure what to tell you, because I'm observing exactly opposite behaviour |
In your example
You'll see that the activation event does not occur, while this pull-request does. |
@vince-fugnitto Ah, I see. It does work if file is gitignored, but doesn't if folder is also gitignored. Tbh, I don't really get the logic behind vscode implementation, it leaves out use cases that are useful. In fact, we need some way to trigger plugin activation, if compilation database (compile_commands.json) exists in the workspace, and its common to put it in .gitignore as a build artifact. |
I believe the pull-request can be closed, from the last feedback (#8671 (comment)) the changes will incorrectly activate the extension which differs from behavior compared to vscode. If we continue we should find a way which does not break this behavior. |
What it does
Fixes #8669: workspaceContains activation event doesn't fire if matched file found in .gitignore, it's expected behavior of ripgrep.
This PR changes arguments for fileSearchService when looking for files matched by workspaceContains pattern, adding useGitIgnore=false, in result ripgrep will run with '-uu' flag and include .gitignore entries in search results.
Impact is limited to workspaceContains activation event behavior.
How to test
**/build/*
Review checklist
Reminder for reviewers
Signed-off-by: Vladimir Fedotov [email protected]