Closed cmaglie closed 3 years ago
@per1234 I've added the autoformat configuration on this branch if you want to give it a try!
cmaglie: hi Akos! is there a way to determine the path to the IDE config file from the LS?
cmaglie :-) (straight to the question :D)
kittaakos: Hi Cristian. Let me think.
cmaglie: maybe you can pass me via cmd-line flag?
kittaakos: From the cwd of the Arduino LS process
kittaakos: That will always work, I am thinking about a quick solution.
cmaglie: that it's not the IDE config directory, but the directory of the IDE program
cmaglie: I need the ~/.arduinoIDE/... or something
kittaakos: Ahh. It is always ~/.arduinoIDE/arduino-cli.yaml
cmaglie: on linux... :-)
kittaakos: I mean, it’s the same on macOS, on windows it is %USER_PROFILE% or what.
kittaakos: Isn’t a thing in go, os.homeDir() or something? I am just asking.
kittaakos: It is not under AppData/Local/Somthing
cmaglie: yes, but I would like to keep those logic outside of the LS
cmaglie: so it's reusable in case, also another question
kittaakos: OK, so it’s a request, and not a question. Did I get this correctly?
cmaglie: do you think that a file in ~/.arduinoIDE/.clang-format is good? I mean from a UX point of view
cmaglie: yes, but I'm not sure (that's why my last question ^^^)
cmaglie: I guess we need some GUI support for that? like a command like "Edit global clang formatting options" that open the file to edit it, at the very minimum
cmaglie: ok let me do it this way: for now I'll put an OPTIONAL command line flag, that specifies the path of that global clang-conf file. If the file is there it will be used otherwise not
cmaglie: I'll let Ubi or RSora decide on the priority of this one on the IDE
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.
arduino-cli-config.yaml
lives. (Yes, there won't be any files there)formatterPath
(or similar); if specified, accessible, and valid, that file should win.From this point, the IDE2 should provide the formatterPath
path when it starts the LS. The IDE2 checks; whether there is a formatter file in the sketch folder. If so, it passes to the LS. If no, the IDE2 will create one on the fly, next to the IDE2's internal config, and forwards that to the LS.
Why is it useful:
formatterPath
manually, via settings.json
or a command.
Should fix some auto-format issues.
Maybe this should be done on the sketchmapper side?