Skip to content

Fix auto closing comments not work properly in certain situations #226074

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

BABA983
Copy link
Contributor

@BABA983 BABA983 commented Aug 20, 2024

Close #156031

@BABA983
Copy link
Contributor Author

BABA983 commented Sep 2, 2024

@rebornix Could you take some time to look at this PR? Thanks!

@BABA983
Copy link
Contributor Author

BABA983 commented Sep 12, 2024

@rebornix Sorry for the ping here, would you mind taking some time to look at this PR or could we add this to the September milestone? Thanks!

@rebornix rebornix assigned aiday-mar and unassigned rebornix Sep 13, 2024
@rebornix rebornix requested a review from aiday-mar September 13, 2024 17:02
@aiday-mar aiday-mar added the editor-autoindent Editor auto indentation issues label Sep 13, 2024
@aiday-mar
Copy link
Contributor

Hi @BABA983 thank you for making this PR and I am really sorry for the wait time. I will have a look right now at the PR.

Copy link
Contributor

@aiday-mar aiday-mar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi I looked at the PR. I think the solution you propose is a bit finicky and could lead to unexpected issues. I think instead what we could do is simply not to go through the block comment logic when the cursor is inside a comment. This alternative solution has also been mentioned by one of my teammates on the issue this PR is closing. To verify the token type at a specific position you can use the following code:

model.tokenization.forceTokenization();
model.tokenization.getLineTokens(lineNumber).getStandardTokenType(tokenIndex)

The standard token type can be one of these values:

export const enum StandardTokenType {
	Other = 0,
	Comment = 1,
	String = 2,
	RegEx = 3
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes-requested editor-autoindent Editor auto indentation issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typing a star in a comment block will lead to an extra end symbol
3 participants