-
-
Notifications
You must be signed in to change notification settings - Fork 17
Do not consider preprocessed section as part of the sketch. #69
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
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.
Using Arduino IDE 2.0.0-beta.2-snapshot.f9730ab, auto format was not working reliably (usually not at all) for me. After replacing the Arduino language server bundled with that build with the one from this PR, I am not noticing any unreliability in the auto format.
@per1234 I've added the autoformat configuration on this branch if you want to give it a try! |
handler/handler.go
Outdated
// https://github.com/llvm/llvm-project/blob/64d06ed9c9e0389cd27545d2f6e20455a91d89b1/clang-tools-extra/clangd/ClangdLSPServer.cpp#L856-L868 | ||
// https://github.com/llvm/llvm-project/blob/64d06ed9c9e0389cd27545d2f6e20455a91d89b1/clang-tools-extra/clangd/ClangdServer.cpp#L402-L404 | ||
|
||
config := ` |
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 tried it out and it works fine for me.
Would it be possible to load the clang-format configuration from a file. Ideally from somewhere like ~/.arduinoIDE/.clang-format
or ~/.arduino15/.clang-format
to allow the users to easily customize the auto format configuration, as they can do in the Java IDE via ~/.arduino15/formatter.conf
?
Would it be possible to copy .clang-format
(if the user added one) from the sketch origin folder to the temporary folder used by the language server, then only write the default .clang-format
to that folder if a user-provided one isn't present? This allows bundling a formatter configuration with the sketch so it will be done consistently by all collaborators. Not something any beginner cares about, but worth adding for the advanced users if it doesn't require much effort to implement and maintain.
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.
Good idea, I'll try to implement it exactly as you described.
These are my ideas, and I always think about the Arduino LS (and the VS Code wrapper around it) as a standalone thing. It should work without IDE2 too. If I were to do the dev on your side, I would do this. These are just recommendations.
From this point, the IDE2 should provide the Why is it useful:
|
Maybe this should be done on the sketchmapper side?
The configuration is provided just for the time needed for the formatter to run, afterwards the file is removed. This should not affect users since the file is created in the temporary folder.
e8298d2
to
08de1bd
Compare
Should fix some auto-format issues.
Maybe this should be done on the sketchmapper side?