sublimelsp / LSP-clangd

C/C++ support for Sublime's LSP plugin provided through clangd.
MIT License
42 stars 1 forks source link

formatting instructions ignored #3

Closed kendfss closed 1 year ago

kendfss commented 1 year ago

I'm writing wrt the guide at:

instructions saved in .clang-format were ignored. Then I tried the settings file. first:

        "clangd.fallback-style": "{IndentWidth: 4}", // as per command line style (I received type warnings when trying to enter in regular object notation)

then:

"command": [
        "/usr/bin/clangd",
        "-i",
        "-style='{IndentWidth: 4}'"
    ]

To no avail. The following (at the command-line) works fine though:

clangd -i -style='{IndentWidth: 4}' main.c

What am I doing wrong? What else should I try?

kendfss commented 1 year ago

I think this is worth closing because the issue seems to be with clangd itself https://github.com/clangd/clangd/issues/362 Gavin's post gives a viable workaround for linux.

rchl commented 1 year ago

.clang-format should probably still work though? The issue you've linked doesn't seem to say anything about that.

The output of LSP: Troubleshoot server might help to analyze that (assuming that .clang-format should work).

kendfss commented 1 year ago

It didn't work until I put it under /. This is fine for me because I don't use this server for anything other than small personal projects, but I assume it won't be ideal for people looking to alternate between/contribute to larger ones. I never checked the output (assuming it isn't automatically printed into the sublime terminal). I'll check it out later this week though.