You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds support for per library setting in ignoreDir as requested in #3213.
Use case
Ignore a same named folder in the library path, but not in current workspace.
For more details please refer to the discussion link above.
Proposed Solution
After in-depth discussion, we come up with the following approach with NO change to existing API while maintaining backward compatibility:
check if an ignoreDir path is a subpath of any library path
if it is a subpath of a library path
extract this subpath (which is a relative path to that library path)
convert it to absolute gitignore pattern by adding a leading /
keep it as library specific ignore pattern
otherwise treat it as global ignore pattern as before
Example Config
{
"workspace.library": [ "/path/to/lib", "/path/to/lib2" ],
"workspace.ignoreDir": [
"/path/to/lib/**/lib-ignore", // extracted pattern will be "/**/lib-ignore" and only applies to "/path/to/lib""global-ignore"// this will still apply to all of "/path/to/lib", "/path/to/lib2", current workspace
]
}
I think the use of `"${lib:idx}" should be supported
${lib:idx} This is not good 🤔
Because this is affected by the order of the corresponding entry in workspace.library[]
If user interpolates => in the middle of array, then the subsequent index will be messed up
And it is completely unintuitive, for example when you see ignoreDir: [ "${lib:2}/xxx/yyy" ]
=> I can't see which library path lib:2 is
=> You have to manually count what is the corresponding element in workspace.library[]? 😂
... and ${workspaceFolder:name}
It's a good idea indeed
This placeholder should be in files.normalize()
The m.resolvePathPlaceholders is handled by
But the problem is how to deal with per library ignoreDir in this PR
Because m.getLibraryMatchers itself has a chance Create 1 matcher for every library
=> I press the matcher corresponding to library path to write different ignore patterns
And for the workspace root's own path matcher
I'm not sure how it works 😕
I see that m.getNativeMatcher will only return 1 matcher in the end?
Not sure how to support it 🙈
If necessary, support ignoreDir for different workspaceFolder in multi root workspace
I feel like it should be better to open a new PR?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for per library setting in
ignoreDiras requested in #3213.Use case
Ignore a same named folder in the library path, but not in current workspace.
For more details please refer to the discussion link above.
Proposed Solution
After in-depth discussion, we come up with the following approach with NO change to existing API while maintaining backward compatibility:
ignoreDirpath is a subpath of any library path/Example Config
{ "workspace.library": [ "/path/to/lib", "/path/to/lib2" ], "workspace.ignoreDir": [ "/path/to/lib/**/lib-ignore", // extracted pattern will be "/**/lib-ignore" and only applies to "/path/to/lib" "global-ignore" // this will still apply to all of "/path/to/lib", "/path/to/lib2", current workspace ] }中文版
支持
workspace.ignoreDir配置 只應用在指定 library 的 pattern修改方式
ignoreDir,檢查是否屬於任意 library 的 subpath/以換成1個 absolute 的 gitignore pattern