Improve code editor text selection and clean up lint enablement#37474
Merged
bircni merged 3 commits intogo-gitea:mainfrom May 1, 2026
Merged
Improve code editor text selection and clean up lint enablement#37474bircni merged 3 commits intogo-gitea:mainfrom
bircni merged 3 commits intogo-gitea:mainfrom
Conversation
Make `.cm-content` fill the editor area via flex stretching so mousedown in the blank space below the last line starts a text selection. Drop the empty lint gutter for markdown: its hand-written parser emits no error nodes, and nested code-fence parsers are mounted as overlays which the syntax-error linter does not traverse. Switch linter routing from extension matching to `Language.name`, and widen the loose-JSON regex to cover `.jsonc`/`.json5`, which previously fell through to the strict syntax-error linter. Co-Authored-By: Claude (Opus 4.7) <[email protected]>
Files like `tsconfig.JSON` or `foo.JSONC` previously fell through the loose-JSON branch and got the strict JSON linter. The old extension-based code had the same bug; fix it while we're here. Co-Authored-By: Claude (Opus 4.7) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the web CodeMirror editor’s layout and linter enablement to improve UX (text selection on empty editor space) and reduce unnecessary lint UI (especially for Markdown / JSONC-like files).
Changes:
- Update editor CSS layout to ensure the content area stretches, allowing text selection to begin on empty space.
- Refactor linter selection to use the loaded CodeMirror language (and disable lint gutter for Markdown / StreamLanguage modes).
- Expand JSONC detection to cover
.jsonc/.json5in addition to specific.jsonbasenames.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
web_src/js/modules/codeeditor/main.ts |
Refactors linter-extension selection using LanguageSupport, disables lint gutter for markdown, and updates JSONC/JSON5 detection. |
web_src/css/modules/codeeditor.css |
Switches editor container to a flex layout and stretches .cm-content to fill the editor for improved selection behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lunny
approved these changes
Apr 29, 2026
bircni
approved these changes
May 1, 2026
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.
getLinterExtensionto not rely on file extensions.This PR was written with the help of Claude Opus 4.7