microsoft / microsoft/vscode-html-languageservice

Triggering code completion with a commit character (`/` in HTML) immediately accepts the first suggestion

Open
#184 1 comment 2 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

feature-request help wanted html
Dominant language
TypeScript
Stars
284
Forks
138
Avg merge
19h 11m
Merged PRs (30d)
5

Description

Given the following HTML (which is missing a / in the closing script tag):

<html>
	<head>
		<script><script>
	</head>
	<body></body>
</html>

Trying to insert a / in the closing script tag triggers completion and then immediately accepts the first item (presumably because / is both a trigger character and a commit character):

https://github.com/microsoft/vscode/assets/1078012/29c7b531-dbff-4169-aa09-02ed4320ce1d

This feels like odd behaviour. Normally when you use a commit character the item that will be accepted was visible, but here a single character both triggered and accepted code completion.

I feel like probably a commit character should be ignored if it was also the trigger, or if that doesn't seem like good functionality, perhaps the HTML support should better handle the case where you're already inside a tag and pressing /.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.