feat(config): configurable workspace scan extensions and excludes - #58
Merged
Conversation
Adds a [workspace] section to .forth-lsp.toml:
- extensions: file extensions treated as Forth source. Lets users drop
"fs" when it collides with F# or GLSL fragment shaders.
- exclude: folder/file name patterns to skip while scanning, matched per
path component with * and ? wildcards.
Defaults reproduce the previous hardcoded extension list, so existing
setups are unaffected, and additionally skip .git, target and node_modules
so scanning is strictly faster than before.
Closes #51
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replaces the bespoke * / ? matcher with glob::Pattern — a small, well-known rust-lang crate (no extra transitive deps). Less code to reason about, and standard shell-glob semantics including character classes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AlexanderBrevig
added a commit
that referenced
this pull request
Aug 31, 2026
Fixes a formatting deviation merged in #58 that left `cargo fmt --all --check` (and therefore main's CI) red. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AlexanderBrevig
added a commit
that referenced
this pull request
Aug 31, 2026
* fix(completion): suppress completions inside comments Typing inside a \ line comment or ( ... ) comment no longer triggers word/colon completions. A ':' typed in a comment is prose, not the start of a colon definition, so offering ':' / ':NONAME' there was misleading (and made the popup in #41 look server-driven). handle_completion now lexes the document and returns no completions when the cursor's byte offset falls within a Comment or StackComment token. The end offset is inclusive so completions are also suppressed while appending to the end of a comment. Adds unit tests for position_in_comment and an end-to-end regression test (tests/repro_issue_41.rs) that drives the real binary over stdio and asserts completion is empty inside a comment and formatting never injects a stray semicolon. Refs #41 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * style: rustfmt the workspace-config test closure Fixes a formatting deviation merged in #58 that left `cargo fmt --all --check` (and therefore main's CI) red. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #51.
Problem
.fsfiles (F#, GLSL fragment shaders) were unconditionally scanned and indexed as Forth, because the recognised extensions were hardcoded inmain.rswith no way to opt out. There was also no way to exclude a folder from scanning.Change
Adds a
[workspace]section to.forth-lsp.toml, using the config machinery that already exists (Config::load_from_workspace):extensions— the primary fix for the.fsclash: redefine the set without"fs".exclude— skip folders/files; excluding a folder prunes its whole subtree. Matching is per-path-component (not full paths), so a project living under a path that merely containstargetisn't wrongly skipped. Kept dependency-free with a tiny*/?glob matcher.Backward compatibility
[workspace], behaves as before — the defaults reproduce the historical extension list exactly (case-insensitive)..git,target, andnode_modules, so scanning is strictly faster than the old "descend into everything" behaviour.Scope / notes
.fsbuffer is client-side (filetype → languageId) and out of scope here.Tests
5 new tests (252 total pass): legacy-default parity, default noise-dir exclusion + the root-path false-positive guard,
extensionsoverride dropping.fs,excludeoverride with globs, and the glob matcher itself.cargo clippy --all-targetsis clean.🤖 Generated with Claude Code