-
Notifications
You must be signed in to change notification settings - Fork 57
Add projectDiscoveryExclude setting and files.watcherExclude support #1535
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d48bedc
Initial plan
Copilot 399b94c
Implement projectDiscoveryExclude and files.watcherExclude support
Copilot e11d97a
Add comprehensive tests for undefined handling and documentation
Copilot 1a78f00
Merge branch 'master' into copilot/fix-1527
TwitchBronBron 817c04e
Fix comma
TwitchBronBron d569bc2
Fix lint issues
TwitchBronBron a6fcfcf
Simplify the `extractExcludes` func
TwitchBronBron 3a4f82b
Integrate projectDiscoveryExclude into the `getWorkspaceExcludeGlobs`…
TwitchBronBron fa7ed4f
Add test for projectDiscoveryExclude in getWorkspaceExcludeGlobs and …
Copilot 2328860
Revert projectDiscoveryExclude to object structure as requested
Copilot ea454b3
Merge branch 'master' into copilot/fix-1527
TwitchBronBron 60266ed
Fix `projectDiscoveryExclude` in tests to use object structure. Reduc…
TwitchBronBron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # Language Server Settings | ||
|
|
||
| The BrighterScript language server provides several configuration options to customize its behavior for your project. | ||
|
|
||
| ## Configuration | ||
|
|
||
| All language server settings are configured under the `brightscript.languageServer` section in your VS Code settings. | ||
|
|
||
| ### projectDiscoveryExclude | ||
|
|
||
| The `projectDiscoveryExclude` setting allows you to exclude files and directories from project discovery using glob patterns. This is useful when you want to prevent the language server from creating projects for certain directories or files. | ||
|
|
||
| **Type:** `string[]` | ||
|
|
||
| **Default:** `undefined` | ||
|
|
||
| **Example:** | ||
| ```json | ||
| { | ||
| "brightscript.languageServer.projectDiscoveryExclude": [ | ||
| "**/test/**", | ||
| "**/node_modules/**", | ||
| "**/.build/**", | ||
| "**/dist/**" | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| This setting works similarly to VS Code's `files.exclude` setting but is specifically for controlling which files are considered during project discovery. | ||
|
|
||
| ### files.watcherExclude Support | ||
|
|
||
| The language server now automatically respects VS Code's built-in `files.watcherExclude` setting. This setting allows you to exclude files from being watched for changes, which can improve performance in large projects. | ||
|
|
||
| **Type:** `Record<string, boolean>` | ||
|
|
||
| **Example:** | ||
| ```json | ||
| { | ||
| "files.watcherExclude": { | ||
| "**/tmp/**": true, | ||
| "**/cache/**": true, | ||
| "**/node_modules/**": true, | ||
| "**/.git/objects/**": true | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Files matching patterns in `files.watcherExclude` will be ignored during file watching, which can help reduce system resource usage and improve performance. | ||
|
|
||
| ## How Exclusion Works | ||
|
|
||
| The language server uses multiple exclusion sources to determine which files to process: | ||
|
|
||
| 1. **VS Code's built-in exclusions:** | ||
| - `files.exclude` - Files excluded from VS Code's file explorer | ||
| - `files.watcherExclude` - Files excluded from file watching | ||
| - `search.exclude` - Files excluded from search operations | ||
|
|
||
| 2. **BrighterScript-specific exclusions:** | ||
| - `brightscript.languageServer.projectDiscoveryExclude` - Files excluded from project discovery | ||
|
|
||
| 3. **Standard exclusions:** | ||
| - `.gitignore` patterns | ||
| - Common directories like `node_modules`, `.git`, `out`, `.roku-deploy-staging` | ||
|
|
||
| All these exclusion patterns work together to provide comprehensive control over which files the language server processes. | ||
|
|
||
| ## Performance Tips | ||
|
|
||
| For better performance in large projects, consider excluding: | ||
|
|
||
| - Build output directories (`**/dist/**`, `**/build/**`, `**/out/**`) | ||
| - Test files that don't need language server analysis (`**/test/**`, `**/*.spec.*`) | ||
| - Temporary directories (`**/tmp/**`, `**/cache/**`) | ||
| - Package dependencies (`**/node_modules/**`) | ||
| - Version control directories (`**/.git/**`) | ||
|
|
||
| ## Compatibility | ||
|
|
||
| Both `projectDiscoveryExclude` and `files.watcherExclude` support work with existing exclusion mechanisms and maintain backward compatibility with existing configurations. |
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
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
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.
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.
This is incorrect. It should follow the same structure as
files.excludeandwatch.exclude. An object with keys as string globs, and booleans as enabled/disabled. Please revert most of what you did in the last commit and adjust to this object structure. be sure to fix the documentation, these interfaces, and restore the old extractExcludes function to how it was.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.
Reverted projectDiscoveryExclude to use object structure (Record<string, boolean>) instead of array format. Updated the interface definition, restored the original extractExcludes function, updated documentation examples, and ensured all tests pass. Changes committed in 2328860.