-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
print all parsed LSP tokens as warnings in VScode #1148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks handy! LGTM
sway-lsp/src/server.rs
Outdated
} | ||
|
||
impl Backend { | ||
pub fn new(client: Client) -> Self { | ||
let session = Arc::new(Session::new()); | ||
Backend { client, session } | ||
let debug = debug::DebugFlags { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could potentially derive Default
for DebugFlags
and use debug::DebugFlags::default();
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did think of doing that. This way though it makes it really quick while developing to just set the variable to true
and then back to false
when you're finished.
Is it possible to make this configurable at run time with a toggle in the Vscode settings page? Under a "debug" or "advanced" section maybe. |
That's a really good idea. Not sure how to set this up but will look into it today. This method of enabling flags could be really beneficial though going forward! |
c38ba72
to
8df3ce5
Compare
1f01423
to
4b07205
Compare
4b07205
to
140e736
Compare
@adlerjohn this should be good now. I've opened up a PR here that enables this functionality for the VScode plugin as well. Have tested on my end and everything works nicely. |
@@ -1966,9 +1966,9 @@ dependencies = [ | |||
|
|||
[[package]] | |||
name = "lsp-types" | |||
version = "0.92.0" | |||
version = "0.92.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was the lockfile updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting local build errors with 0.92.0
after adding #[derive(Default)]
for the new DebugFlags
struct. updating to 0.92.1
fixed this.
This enables a flag to be set when developing and debugging the sway-lsp server. See issue #1123 for more context, but essentially it visually shows the successfully parsed tokens in VSCode. This allows for quickly scanning a bunch of sway files to see what tokens are being ignored by our current implementation of the sway-lsp parser. See the below image for how this looks in the editor when enabled. For example, In the image below we can see that the entire
impl
block is being ignored.closes #1123