I'm working on some procedural macros in Rust and I use vim-lsp to help me write Rust. I find it very helpful when the compiler error suggests a change to fix an error and I can use a quick action to apply the fix.
In my proc macros, I use syn::Error to provide spanned compiler errors for users of my macros. Is there any way for me to encode quick fixes into my compiler errors?
Related
I have a file with loads of redundant x?.let { it.something() } and I want to keep them this way.
How do I suppress the warning? IDE doesn't offer suppression here. I've looked into Errors.java and DefaultErrorMessages.java but nothing seemed to fit.
More general question: what arguments are supported by #Suppress annotation?
Like I said in the comment on the other question, just use the IDE to suppress warnings - every warning popup has a 'More Options' link, or you can put the cursor on the highlighted bit of code and do Alt+Enter (or whatever) or click the lightbulb. Then you'll get a list of actions for the warning, and you can hit the right arrow to get options for each one - the main action (the "fix it" one) has options that allow you to suppress the warning instead:
There's no defined set of possible things you can suppress, because things like lint checks can be added to over time (or by using libraries that provide their own checks), IDE features can be expanded, etc. Like the language spec says:
kotlin.Suppress is used to optionally mark any piece of code as suppressing some language feature, such as a compiler warning, an IDE mechanism or a language feature. The names of features which one can suppress with this annotation are implementation-defined, as is the processing of this annotation itself.
So it's better to let the IDE do it automatically since it knows the name of the inspection being triggered when it warns you about a thing, so it can create the appropriate annotation.
Generally you shouldn't be suppressing these anyway, they're highlighting code that has issues, is unnecessarily complex, or that isn't actually what you think it is (like in my example there, I'm treating the value as potentially null - but it's not actually a nullable type). It's better to fix the issue rather than suppress it and leave the intent ambiguous. Even if you know what it means and what it's supposed to do, someone who comes along later might be confused by it (possibly Future You!). There are some situations where it's necessary or useful, but generally speaking the warnings are there for a good reason.
ScriptRunner for Jira is not even throwing basic compile time errors! I was using a variable that was written wrong and I didn't even receive a warning for that and it took me so much time to figure it out! If anyone knows a trick, let me know! How can we use the script editor and receive warnings for compile time errors. Otherwise, writing the code and debugging it is taking so much more time. Coding should not be this complicated and we should be able to detect all syntax related errors.
Whenever I try to use a chain function, the intellisense sometimes suggests me something other than the exactly typed word first, which is weird.Here is the image of the issue
Help :)
I am trying to learn Rust, and I like Geany. I don't know how to do code completion with Geany. I have all of the settings turned on for it, but it only recognises C++ syntax for code completion/assist, not Rust. How can I fix this?
I don't think it is possible for Geany now, at least according to https://areweideyet.com/
For now, the most stable tool in rust for completion is rust-analyzer. It works over Language-Server Protocol, but it seems to be missing in Geany.
I was looking for a way to decompile JavaScript that was compiled by Google Closure. I did find a Decompiler class (https://code.google.com/p/closure-compiler/source/browse/lib/rhino/src/org/mozilla/javascript/Decompiler.java?name=v20140407), however I haven't had much luck with it.
Anyone try this before or know of some other method?
Usually, I just run the code through the Closure Compiler in WHITESPACE mode and enable the pretty printing options.