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

apply the appropriate language configuration as the selected cell changes #2592

Merged
merged 1 commit into from
Jan 7, 2023

Conversation

brettfo
Copy link
Member

@brettfo brettfo commented Jan 6, 2023

This allows the comment/uncomment keyboard shortcuts Ctrl+K,C/Ctrl+K,U to work based on the language of the current cell. This also allows things like auto-complete to fill in ) after a ( is typed, etc.

This doesn't work, however, if the cursor is after a kernel selector magic command like this:

// this is a C# cell

#!python
print("hello from python")

If the user tries to comment the print(..) line it'll be replaced by // print(...) instead of # print(...) because we have no way of detecting the cursor's location, and thus the current language at the cursor. If we did it would be trivial to see that we were in a #!python selector and to the right thing, but since polyglot cells aren't as common, this is a shortcoming we'll have to deal with.

Fixes #2559.

@AbhitejJohn
Copy link
Contributor

we have no way of detecting the cursor's location, and thus the current language at the cursor

Would this be in the VS Code layer? Perhaps we could file a feature request, so this can be made simpler in the long term.

@brettfo
Copy link
Member Author

brettfo commented Jan 6, 2023

@AbhitejJohn Slight correction to my statement above: we have no way of detecting when the cursor location changes, so we can't respond to the user arrowing around in the file. I'll think about exactly what we would need and submit a suggestion.

@brettfo brettfo merged commit 7be5491 into dotnet:main Jan 7, 2023
@brettfo brettfo deleted the language-comments branch January 7, 2023 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commenting-out code in cells does not work after last update
4 participants