-
Notifications
You must be signed in to change notification settings - Fork 61
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
Configurable folder excludes #519
Conversation
9267428
to
7233a47
Compare
86b0ea6
to
e430c58
Compare
77a03ed
to
3f554ca
Compare
17f29ae
to
08ce8d0
Compare
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.
Great, thanks! I have a few proposals for reorganizing.
if (parentWsFolder) { | ||
// create path relative to workspace folder root: /user/foo/workspace/entry.txt -> entry.txt | ||
const wsFolderPath = URI.parse(parentWsFolder).path + '/'; | ||
entryPath = entryPath.replace(wsFolderPath, ''); |
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.
The string operations startsWith
and replace
seem unsafe to me: they can lead to false matches. Following my recommendation of moving this file to sprotty-vscode
, you can use the Node.js path
module for path operations.
packages/langium/src/grammar/workspace/grammar-workspace-manager.ts
Outdated
Show resolved
Hide resolved
4bc41ef
to
04eec5d
Compare
@dhuebner There's a compilation error in your latest changes |
0630b5d
to
0d6d2a7
Compare
@msujew |
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.
Thanks for the restructuring!
packages/langium-vscode/src/language-server/grammar-workspace-manager.ts
Outdated
Show resolved
Hide resolved
if (parentWsFolder) { | ||
// create path relative to workspace folder root: /user/foo/workspace/entry.txt -> entry.txt | ||
const wsFolderPath = URI.parse(parentWsFolder).path + '/'; | ||
entryPath = entryPath.replace(wsFolderPath, ''); |
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.
See my previous comment. Could you try using the path module instead of startsWith
and replace
string operations?
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.
Well, it doesn't matter which API we would use, we can't recover the missing information about the WorkspaceFolder we are operating on. That means that we can't create a WSFolder relative path.
I think the best is to pass over the WorkspaceFolder, I changed the implementation accordingly
0d6d2a7
to
2dbbf27
Compare
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.
👍
Introduces a new configuration service.
Configuration service listens for changes of all registered Langium languages. Configurations are updated when user changes the settings (user/workspace). Other services can request configurations using:
getConfiguration(language: string, configuration: string)
Each language will have his own settings section, section name is the
<languageId>-settings
.Exclude pattern syntax is handled by node-ignore module kaelzhang/node-ignore
For Langium grammar language it allows configuration of excluded folders using vscode settings.
Fixes #344