Skip to content
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

clang-format in null-ls doesn't follow .clang-format file #581

Closed
2 tasks done
vollowx opened this issue Mar 17, 2023 · 4 comments
Closed
2 tasks done

clang-format in null-ls doesn't follow .clang-format file #581

vollowx opened this issue Mar 17, 2023 · 4 comments
Labels
duplicate This issue or pull request already exists formatting Lsp-formatting related issues usage User-specific issues

Comments

@vollowx
Copy link
Contributor

vollowx commented Mar 17, 2023

Version confirmation

  • Confirm

Following prerequisites

  • Confirm

Neovim version

NVIM v0.9.0-dev-1193+ga7cd79349

Operating system/version

Archlinux

Terminal name/version

kitty 0.27.1

$TERM environment variable

xterm-kitty

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

Affected language servers

clangd, null-ls

How to reproduce the issue

:Mason

find clang-format

i to install

q to exit mason panel

touch a .clang-format file in the c++ project root dir with content

Language: Cpp
BasedOnStyle: Google

edit a c++ file

C-s to save and format

A-d to open a terminal and run clang-format [filename]

Actual behavior

file content doesn't formatted with the clang-format config file, clang-format in console runs well.

Expected behavior

file formatted with .clang-format file

Support info

image

image

Logs

No response

Additional information

No response

@vollowx vollowx added bug Something isn't working lsp LSP related issues labels Mar 17, 2023
@vollowx
Copy link
Contributor Author

vollowx commented Mar 17, 2023

Sorry about this, I think I found what the problem is

image

It's defined in this file

@vollowx vollowx closed this as completed Mar 17, 2023
@aarnphm
Copy link
Collaborator

aarnphm commented Mar 17, 2023

I also mentioned this somewheree else, but you can do the following in null-ls

					f.clang_format.with {
						extra_args = {
							string.format(
								"--style=file:%s/.clang-format",
								require("user.utils").get_root()
							),
						},
					},

which is this comment #557 (comment)

@vollowx
Copy link
Contributor Author

vollowx commented Mar 18, 2023

thanks!

@Jint-lzxy Jint-lzxy added duplicate This issue or pull request already exists usage User-specific issues formatting Lsp-formatting related issues and removed bug Something isn't working lsp LSP related issues labels Mar 18, 2023
@yinghaoyu
Copy link

Sorry about this, I think I found what the problem is

image

It's defined in this file

Did you change it to "-style=file" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists formatting Lsp-formatting related issues usage User-specific issues
Projects
None yet
Development

No branches or pull requests

4 participants