Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for cmake-format. #163

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

Open
antmusco wants to merge 1 commit into google:master
base: master
Choose a base branch
Loading
from antmusco:feature/cmake-format-support

Conversation

@antmusco
Copy link

@antmusco antmusco commented Sep 13, 2020
edited
Loading

Includes autoload/codefmt/cmakeformat.vim which adds support for cmake-format for formatting CMake files. Adds two additional flags, cmake_format_executable, which defaults to cmake-format, and cmake_format_config, which defaults to the empty string (i.e. default formatter).

Addresses issue #162

Copy link

google-cla bot commented Sep 13, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

i️ Googlers: Go here for more info.

Copy link
Contributor

@dbarnett dbarnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're able to run the vimdoc tool from http://github.com/google/vimdoc to generate help files from your comments, that would be helpful.

" Generate formatted output.
let l:input = join(getline(1, line('$')), "\n")
let l:result = maktaba#syscall#Create(l:cmd).WithStdin(l:input).Call()
let l:formatted = split(l:result.stdout, "\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to use split's keepempty argument here, split(STDOUT, "\n", 1), so you have consistent results if the first or last line is empty.

let l:formatted = split(l:result.stdout, "\n")

" Overwrite buffer.
call maktaba#buffer#Overwrite(1, line('$'), l:formatted[0:])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the [0:] slicing for? Should be a no-op except for making a copy of the list before passing it to Overwrite, which AFAIK isn't needed.


""
" The path to the cmake-format configuration file for cmake-format to use.
" See https://cmake-format.readthedocs.io/en/latest/installation.html for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like actually https://cmake-format.readthedocs.io/en/latest/configuration.html has the details and installation.html doesn't say much about it.

amusco-amz reacted with thumbs up emoji
Comment on lines +75 to +78
" The path to the cmake-format configuration file for cmake-format to use.
" See https://cmake-format.readthedocs.io/en/latest/installation.html for
" details.
call s:plugin.Flag('cmake_format_config', '')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag is global, so it will be a single value used for every file you edit. Is that what you'd want?

By my reading of https://cmake-format.readthedocs.io/en/latest/configuration.html, you can pass multiple config files, and that's independent of the automatic detection of files like \.?cmake-format(.yaml|.json|.py) that it finds on the path? Can you confirm if an explicit config overrides any automatic config detection and note that in the doc comments?

Copy link

morxa commented Jun 28, 2021

@antmusco I'd really like to have support for cmake-format, so if you could pick this up again, I'd be very grateful :) Please let me know if I can help!

ar1ja pushed a commit to ar1ja/vim-codefmt that referenced this pull request Jan 15, 2022
Signed-off-by: Ari Archer <truncateddinosour@gmail.com>
Copy link
Contributor

@morxa looks like this got abandoned. If you'd like to pick up the changes and send your own PR we can finish the review and try to get something merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@dbarnett dbarnett dbarnett requested changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /