Comments (10)
Would it be possible to format the code asynchronously? It's kind of unexpected that it's a synchronous operation blocking the UI.
If not, I think it makes sense for you to be able to opt out. 👍
from helix.
Sorry about that, I missed the comment! I think some of this overlaps with #177 (comment)
I'd be interested in this, but the async
aspects of helix-term
still need some work. It's hard to keep a reference in a spawned task without blocking, you'd probably need some sort of a callback mechanism similar to how the LspCallbacks
hack works (you keep a DocumentId
, the callback gives you a &mut Editor
that can be used to look up the doc again).
from helix.
This is because we try to :format
via the LSP before saving. I was afraid this would be an issue on a slower language server (you can also notice it before rust-analyzer fully boots up). Need to handle that better, probably by making it opt-in per language.
from helix.
I think you would likely run into issues if formatting took a while to run async while you made further text edits.
I'll add a config option to enable it only for certain languages.
from helix.
Yeah, I guess it depends. I've seen it done both ways. If done asynchronously, one could discard the formatting if the buffer changed in between saving the file and the action actually completing.
from helix.
I think it does make sense to discard the formatting in that case, but one annoying thing is that you want the formatting to be saved. I guess you'd need to:
- make a clone of the document synchronously (cheap, because Ropes clone cheaply)
- spawn a "format" task that computes the formatting changes, then spawns a "save" task and returns the formatting changes
- the "save" task applies the formatting changes to the cloned document and then saves it
- the main task gets the formatting changes from the format task and applies them as long as the document hasn't changed.
I could try implementing that if it sounds reasonable.
from helix.
Same noticeable delay when I press gd
waiting for lsp. It doesn't automatically do the task even though lsp starts up. Should have sort of queuing mechanism.
from helix.
Is there no interest in the async formatting version? I like auto-format on save, but I'd also like it not to block the editor...
from helix.
Same noticeable delay when I press
gd
waiting for lsp. It doesn't automatically do the task even though lsp starts up. Should have sort of queuing mechanism.
This is because rust-analyzer takes some time to index before it starts responding to queries. workDone
events from LSP will give us a way to cancel these types of queries, at the moment we time out after 2s
and then discard the data once received later.
from helix.
#285 now solves this, thanks to @jneem for the implementation!
from helix.
Related Issues (20)
- File autocomplete in :open breaks with symlinks HOT 1
- `CTRL+c` causes Helix to crash after Nushell LSP crashes HOT 1
- Space / global search feature is broken HOT 3
- Weird behaviour: sometimes 'normal' parts of Latex code get highlighted as warning.
- support multiple root directories for file picker HOT 4
- Extremely slow python autocomplete performance HOT 3
- Display recent files at the top of file picker HOT 2
- Auto-Complete adds double $ character after choosing a value from the dropdown menu
- lua-language-server exits on start
- Feature Request: Custom Snippet Support
- Enhancement: Custom Snippet Support HOT 1
- Clojure-lsp go to definition not working for dependencies/core library functions
- Insert cursor bar style
- sequences of commands interact poorly with interactive commands in mappings
- Crash when trying to debug: "no entry found for key" HOT 3
- Pop-up menu on long-press of modifier keys HOT 3
- Helix Crashes when accessing suggestion for text completion HOT 2
- Godot Classes Break
- `x=` freeze in typescript file HOT 1
- Make clang-tidy work with helix editor
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 helix.