Repository navigation
build(bin,lsp): add lsp feature flag to executable - #18148
Conversation
|
I'm not sure about this but i'd call the feature lsp vs nu-lsp. |
Yeah, this was me being lazy about adding a feature flag declaration. Glad I got called out! |
| LanguageServer::initialize_stdio_connection(engine_state)?.serve_requests()? | ||
| if is_lsp { | ||
| #[cfg(feature = "lsp")] | ||
| run_lsp(engine_state, parsed_nu_cli_args, use_color)?; |
There was a problem hiding this comment.
you should probably pass the start_time to the run_lsp function instead of starting a new one and put it at the top like the function does.
There was a problem hiding this comment.
Hopefully I've addressed this correctly: d718675
|
Can you fix the merge conflicts please? |
| #[cfg(feature = "mcp")] | ||
| if parsed_nu_cli_args.mcp { | ||
| perf!("mcp starting", start_time, use_color); | ||
| perf!("mcp starting", nu_utils::time::Instant::now(), use_color); |
There was a problem hiding this comment.
the point of the start_time is not to start it every line that has perf! on it. can we switch all these perf! lines back and make sure it works as it originally did (as far as perf! goes). You can see what perf! lines look like with nu --log-level info
There was a problem hiding this comment.
@fdncred I think I am more confused now, all perf calls use past tense:
nushell/crates/nu-utils/src/utils.rs
Line 499 in de95b1f
And yet the log here is done before the mcp server initialized so for the lsp section the log below implies that starting the lsp took ~13 microseconds:
[INFO ] nu::run: perf: src/run.rs:231:5 lsp starting took 12.667µsThere was a problem hiding this comment.
I've hopefully addressed feedback in 6a945cf but I'm still unsure of the reasoning
There was a problem hiding this comment.
The reasoning is that perf! is supposed to show how long things took to run. It was like that when I added it years ago but people have messed it up over the years.
So, like for the run_lsp command you'd have to remove perf! from the start of the function and do something like:
... all stuff at start of function
let serve_requests = nu_lsp::LanguageServer::initialize_stdio_connection(engine_state)?.serve_requests();
perf!("lsp started", start_time, use_color);
serve_requestsor above do something similar with run_lsp in the if is_lsp instead of having anything in the run_lsp.
I'm not sure if either of those would work. You'd have to experiment. I'm sure there's a better way.
There was a problem hiding this comment.
Thanks for the feedback, @fdncred I am aiming to address this by end of week.
There was a problem hiding this comment.
ok, thanks for working with me.
|
conflicts, ugh. sorry. |
86af869 to
7fe5c75
Compare
|
@fdncred can you take another look? |
|
ok, let's try this. I already fixed the security failure in another PR. |
Description
Add
nu-lspfeature flag to the executable.This change allows the Nushell LSP functionality to be feature gated to help slim down binary size for CI use cases.
Here are some size comparisons:

nushell-pre.tar.gzis the tarball forcargo build --release --no-default-featureson latest mainUser-facing changes (Release notes)
Added support for feature gating LSP functionality, specifically enable it via
--features lsp.Additional notes