Comments (7)
unless you listen for the onDidSaveTextDocument event
That's how it should be done. https://github.com/SamVerschueren/vscode-final-newline/blob/master/extension.ts#L65
from editorconfig-vscode.
This is expected behavior, see #40. This makes sure that the selection is set back to what it was before the save. This this works as well with multiple cursors and multiple selections. It does break intellisense however, but that can't be solved as long as it is not supported in VS Code core.
from editorconfig-vscode.
@SamVerschueren, this issue is a different one. The selection is NOT set to what it was before, because it has the final newline selected (highlighted). See the following screen capture:
If my cursor is anywhere else in the file when I trigger a save then it doesn't happen, but if my cursor is already on the very last character of the file, that's when it happens.
from editorconfig-vscode.
Oh you're right! Thanks for elaborating. Didn't add the put back part yet. This is odd. Should we implement to put back the selections after save then?
from editorconfig-vscode.
I tried to do that myself, but I wasn't having success and was running out of time so I reverted my changes. But yes, I do think we should restore the selections, if possible. The problem is that the TextEdit[]
is not actually, itself, a Thenable<T>
, so you can't really control the restoration of the selections unless you listen for the onDidSaveTextDocument
event, so it gets pretty dirty. e.waitUntil(...)
returns void
, so you can't do a .then()
on that either. It's frustrating.
from editorconfig-vscode.
BTW, this also happens with multiple cursors, but only when one of those cursors is at the very end of the file.
from editorconfig-vscode.
Fixed and published in version 0.6.2!
from editorconfig-vscode.
Related Issues (20)
- Indent style and size are ignored for default (`*`) wildcard HOT 4
- Space indent size is not working in VSCode version 1.74 HOT 3
- after restart vscode, the opened file in view is not work at the beginning HOT 1
- `indent_size` overrides `tab_size` for tab characters HOT 2
- VSCode Makefile `spaces` not converted to `tab` on save HOT 1
- editoconfig doesn't work on mac HOT 2
- `insert_final_newline = false` not working HOT 6
- editorconfig was forcing up changes
- Feature request: `trim_trailing_whitespace` only on modified lines
- csharp_new_line_before_open_brace not working
- Feature request: Ability to set a .editorconfig to use
- Plugin is disabled when using an SSH FS workspace
- It is non-obvious when editorconfig is overriding my chosen tab/indent settings
- auto input enter
- Removes spaces in template literal strings (JS/TS)
- EditorConfig doesn't work well in VSCode (in specific files) HOT 1
- Feature request: Disable automatic cursor transfer when adding the last line. HOT 3
- Impossible to manually change indent style/size HOT 1
- insert_final_newline will open all files when using `Search & Replace`
- recoil doesn't work HOT 1
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 editorconfig-vscode.