Add setting to disable end tag suggestions#219
Merged
aeschli merged 3 commits intomicrosoft:mainfrom Oct 16, 2025
Merged
Conversation
Fixes microsoft#216 This change introduces a new `hideEndTagSuggestions` configuration option in the CompletionConfiguration interface that allows users to disable closing tag suggestions in HTML completions. Previously, the `html.suggest.html5` setting controlled whether HTML5 tags, properties, and values were suggested, but it did not affect closing tag suggestions (e.g., `</div>`). Users who wanted to disable the extension's suggestions entirely had no way to turn off these end tag completions without disabling the entire extension. Changes: - Added `hideEndTagSuggestions?: boolean` to the CompletionConfiguration interface in htmlLanguageTypes.ts - Updated the `collectCloseTagSuggestions` function in htmlCompletion.ts to check this setting and return early if end tag suggestions are disabled - Added comprehensive tests to verify the setting works correctly in various scenarios The setting defaults to `false` (showing end tag suggestions) to maintain backward compatibility with existing behavior. Signed-off-by: Giovanni Magliocchetti <[email protected]>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new configuration option hideEndTagSuggestions that allows users to disable closing tag suggestions (e.g., </div>) in HTML completions while keeping other HTML suggestions active.
- Added
hideEndTagSuggestionsboolean field to theCompletionConfigurationinterface - Modified
collectCloseTagSuggestionsfunction to return early when the setting is enabled - Added comprehensive test coverage for the new functionality in various contexts
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/htmlLanguageTypes.ts | Added hideEndTagSuggestions optional boolean field to CompletionConfiguration interface |
| src/services/htmlCompletion.ts | Added early return in collectCloseTagSuggestions when hideEndTagSuggestions is enabled |
| src/test/completion.test.ts | Added comprehensive test cases covering default behavior, setting enabled, and various contexts |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
6 tasks
Collaborator
|
@copilot Looks good! Can you also add an entry to CHANGELOG.md? The upcoming version is going to be 5.6.0 |
Collaborator
|
@copilot Can you also add an entry to CHANGELOG.md? The upcoming version is going to be 5.6.0 |
aeschli
approved these changes
Oct 16, 2025
sandy081
approved these changes
Oct 16, 2025
Collaborator
|
@obrobrio2000 No worries, all good, thanks for your help! |
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 #216
Summary
This PR introduces a new
hideEndTagSuggestionsconfiguration option that allows users to disable closing tag suggestions in HTML completions.Related Changes
Problem
Currently, the
html.suggest.html5setting controls whether HTML5 tags, properties, and values are suggested, but it does not affect closing tag suggestions (e.g.,</div>). When a user types<in an HTML document, they see both regular tag suggestions and end tag completions for unclosed tags.Users who want to disable all HTML suggestions have no way to turn off these end tag completions without disabling the entire extension. This is particularly important for users of alternative HTML tools (like SuperHTML mentioned in the issue) who want to use VS Code's editor features but prefer to use a different tool for HTML completions.
Solution
This PR adds a new
hideEndTagSuggestionsboolean option to theCompletionConfigurationinterface. When set totrue, the language service will not provide end tag suggestions.Changes Made
vscode-html-languageservice
hideEndTagSuggestions?: booleanto theCompletionConfigurationinterfacecollectCloseTagSuggestionsfunction to check the setting and return early if disabledvscode (VS Code Extension) microsoft/vscode#269605
html.suggest.hideEndTagSuggestionswith default valuefalseTesting
The implementation includes comprehensive test coverage:
hideEndTagSuggestions: true, no end tag suggestions appearhtml5: false)All existing tests continue to pass, ensuring backward compatibility.
Backward Compatibility
The setting defaults to
false, meaning end tag suggestions are shown by default. This maintains the current behavior for all existing users. Only users who explicitly enable this setting will see the change in behavior.Usage
Users can add this to their VS Code settings to disable end tag suggestions:
{ "html.suggest.hideEndTagSuggestions": true }This can be combined with disabling HTML5 suggestions for a minimal suggestion experience:
{ "html.suggest.html5": false, "html.suggest.hideEndTagSuggestions": true }