Comments (6)
There's probably an elegant way to solve it, but I haven't found it yet.
The elegant way is to correctly guess the users intent which is not really feasible. That's why I am using two different hotkeys for commenting. One for the default toggle and one to comment everything that is selected. Considering how rarely I use the latter this is acceptable to me.
Just for comparison, vscode doesn't seem very smart about commenting either. It will often double comment lines which is even more annoying than having two different hotkeys.
from textadept.
I'm also using a customized comment function that allows for this. At the time I was the only one who expressed interest in this, which is why I didn't really push for upstream integration.
It's implemented as an argument so both versions are possible. Additionally, my function inserts a space between the comment token and the text for added clarity.
The changes are minor but I'm still not sure it's worth to integrate into upstream since it is easily implemented in the local init.lua.
from textadept.
I can't reproduce the problem where toggling again doesn't restore the original.
When you "toggle comment" on a line that starts with a comment, I would expect that line to be uncommented, hence my comment. I'm not belittling your solution though. I was just hoping to try and come up with something more elegant that makes a bit more intuitive sense.
from textadept.
The one issue is if you start with a commented line and extend the selection to the line below, for example:
#foo
bar
When you toggle comment, you'll get this:
foo
ar
Toggling again gives you:
#foo
#ar
The idea of "toggle comment" is that every other time you invoke it, you should get back exactly what was there originally.
There's probably an elegant way to solve it, but I haven't found it yet.
from textadept.
The one issue is if you start with a commented line and extend the selection to the line below, for example:
#foo bar
When you toggle comment, you'll get this:
foo ar
Toggling again gives you:
#foo #ar
The idea of "toggle comment" is that every other time you invoke it, you should get back exactly what was there originally.
I can't reproduce the problem where toggling again doesn't restore the original.
Just for comparison, vscode doesn't seem very smart about commenting either. It will often double comment lines which is even more annoying than having two different hotkeys.
This patch tries to replicate VSCode's behaviour where it will double comment, it's really just a matter of taste at this point :)
from textadept.
Ah, thanks for clarifying.
from textadept.
Related Issues (20)
- Typing causes CPU heating at 500 lines 28 kByte large bash lexed file with large string areas. HOT 11
- doesn't compile using msys2 for windows HOT 4
- Curses version opens with an error, session.lua:71 bad argument to iconv #2 (string expected, got nil) HOT 1
- Bash lexer issue with escaping # ( \# ) HOT 5
- Curses version on mlterm seems to have a problem with soft wrapping HOT 4
- Textadept-curses cannot be launched from another process (zk) HOT 9
- Textadept will autoclose " ' ", making it very difficult to write english contractions like "don't" HOT 5
- Configuring markdown and python language servers produces 'failed to execute language server' HOT 1
- Textadept curses on mlterm produces straneous characters HOT 1
- Order of single commands outputs in a shell script is screwed in the output buffer HOT 6
- MacOS: Can't change preferences HOT 1
- Just updated from old (2019) version, howto question about API changes HOT 1
- Undo deletion & caret position HOT 2
- `events.connect(events.LEXER_LOADED,...)` strange behaviour in nightly HOT 2
- Cannot load built-in modules on macOS HOT 2
- how to make current line number have a different color? HOT 5
- ui.print_silent_to() doesn't update the Tab label HOT 1
- lua interpeter scope not working properly HOT 7
- Going for new style snippets, I can't makethem work as per documentation HOT 2
- Problem expanding snippet with $0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textadept.