Skip to content
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

Syntect comment toggle #991

Merged
merged 1 commit into from Nov 29, 2018
Merged

Conversation

cmyr
Copy link
Member

@cmyr cmyr commented Nov 13, 2018

This is based off of #971; the meat here is just the last commit.

There are some things about this implementation that are... weird. It isn't totally clear that this should be in syntect and not in core.

closes #795


This adds syntax-aware comment toggling.

The implementation is sort of weird, in a way that maybe
highlights some of the general weirdness around this feature,
and also maybe illustrates some future directions for plugin-
provided commands.

Basically: comment toggling, like auto-indent, is syntax
dependant. Unlike auto-indent, however, it is also the result
of an explicit user action.

This is a funny case. It seems silly to add a 'toggle_comment'
command to the RPC protocol. We do need to route through core,
because we need to extract the lines to be commented; plugins
do not currently have access to selection state. However we only
expect this to be handled by one plugin.

So: this is a hack. This has given me some ideas about how
plugins can declare their capabilities, though; I'll open an
issue for that in a little bit.

In the meantime, this is a useful feature.

cmyr added a commit to cmyr/xi-mac that referenced this pull request Nov 13, 2018
cmyr added a commit to cmyr/xi-mac that referenced this pull request Nov 13, 2018
@cmyr cmyr force-pushed the feature/syntect-comment-toggle branch 2 times, most recently from 14de5dd to 67fcc78 Compare November 19, 2018 19:20
@cmyr cmyr changed the title [WIP] syntect comment toggle Syntect comment toggle Nov 19, 2018
cmyr added a commit to cmyr/xi-mac that referenced this pull request Nov 20, 2018
This adds syntax-aware comment toggling.

The implementation is sort of weird, in a way that maybe
highlights some of the general weirdness around this feature,
and also maybe illustrates some future directions for plugin-
provided commands.

Basically: comment toggling, like auto-indent, is syntax
dependant. Unlike auto-indent, however, it is also the result
of an explicit user action.

This is a funny case. It seems silly to add a 'toggle_comment'
command to the RPC protocol. We do need to route through core,
because we need to extract the lines to be commented; plugins
do not currently have access to selection state. However we only
expect this to be handled by one plugin.

So: this is a hack. This has given me some ideas about how
plugins can declare their capabilities, though; I'll open an
issue for that in a little bit.

In the meantime, this is a useful feature.
@cmyr cmyr force-pushed the feature/syntect-comment-toggle branch from 67fcc78 to 6caed8a Compare November 27, 2018 04:09
Copy link
Member

@raphlinus raphlinus left a comment

Choose a reason for hiding this comment

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

This looks good to me, and is very useful functionality. Thanks!

@cmyr cmyr merged commit 3fa345a into xi-editor:master Nov 29, 2018
@cmyr cmyr deleted the feature/syntect-comment-toggle branch November 29, 2018 23:40
cmyr added a commit to cmyr/xi-mac that referenced this pull request Nov 29, 2018
cmyr added a commit to xi-editor/xi-mac that referenced this pull request Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add comment toggling
2 participants