Skip to content

Option for auto closing comments#192335

Merged
alexdima merged 4 commits into
mainfrom
alexd/pr-75053-cont
Sep 6, 2023
Merged

Option for auto closing comments#192335
alexdima merged 4 commits into
mainfrom
alexd/pr-75053-cont

Conversation

@alexdima

@alexdima alexdima commented Sep 6, 2023

Copy link
Copy Markdown
Member

Fixes #1966
Continues PR #75053

sergeyvfx and others added 4 commits June 7, 2019 09:18
Has same strategies as autoClosingBrackets and autoClosingQuotes.

This commit does not have any functional changes, just a preparation
for an actual logic.
The tricky part comparing to those existing flags is that their
behavior is defined by a single character, which is how
_isAutoClosingOpenCharType() works. The comments, on another hand,
can consists of multiple characters and they do not fit existing
auto-closing filtering.

To avoid duplication of tokenizing, the decision on whether to place
closing comment or not is based on the electric action which now stored
corresponding token which generated new text.

This allows to filter electric actions in cursor type operations.

Similar to opening/closing pairs the opening/closing comment blocks
are stores in a character map.

Could be a bit overkill, but could as well be more flexible in case
language configuration supports multiple opening/closing comment
blocks (not sure if it is already supported, but in Pascal it is
possible to use { and (* for block comments).

P.S. There might be a trick to fit this logic into existing
isAutoClosing functionality. It does perform tokenization at certain
conditions, but the early output checks and checks for auto-closing
pairs would need to be changed somehow. And is still needed to know
whether typing sequencer is a quote, comment or a brace.
Probably, can check if it's a quote or a brace and consider a
comment otherwise, but seems a bit weak.
@alexdima alexdima self-assigned this Sep 6, 2023
@alexdima alexdima changed the title Alexd/pr-75053-cont Option for auto closing comments Sep 6, 2023
@vscodenpa vscodenpa added this to the September 2023 milestone Sep 6, 2023
@alexdima
alexdima enabled auto-merge (squash) September 6, 2023 19:30
@alexdima
alexdima merged commit 173bc6d into main Sep 6, 2023
@alexdima
alexdima deleted the alexd/pr-75053-cont branch September 6, 2023 21:31
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Ability not to auto-close comments

4 participants