[PATCH] D29221: clang-format-vsix: "format on save" feature

Antonio Maiorano via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 17:56:24 PST 2017


amaiorano added a comment.

In https://reviews.llvm.org/D29221#687438, @amaiorano wrote:

> In https://reviews.llvm.org/D29221#687425, @hans wrote:
>
> > In https://reviews.llvm.org/D29221#686865, @amaiorano wrote:
> >
> > > Made changes based on @hans 's feedback.
> > >
> > > I looked again at the categories, and I think it makes sense with my changes. Here's an updated screenshot that shows what the options menu in Visual Studio looks like with these changes with the top-level category name ("LLVM/Clang") and page name ("Clang Format") highlighted, as well as the category names for the page items ("Format Options" and "Format On Save") highlighted:
> > >
> > > F3117958: pasted_file <https://reviews.llvm.org/F3117958>
> > >
> > > It would be nice if "Format On Save" was _below_ "Format Options", but Visual Studio always orders the page categories in alphabetical order, so this is pretty standard.
> >
> >
> > The screenshot looks good.
> >
> > My only nit is that I'd prefer "clang-format" instead of "ClangFormat".
> >
> > Manuel: the menu options under Tools currently say "Clang Format {Selection,Document}". What do you think about using "clang-format" here instead? That is the name of the tool after all, and I think it also works nicely as a verb.
> >
> > I realize the actual extension is called ClangFormat, but maybe there were reasons for that, or we have to live with it?
>
>
> I would also like clang-format in there rather than ClangFormat. One thing to validate is whether this change would mean people would lose their changes to the defaults in the configuration panel. I'll run some tests and see if this is indeed the case. Maybe there's a way to keep the internal name the same for config purposes, but change the displayed name instead. Will get back to you.


Okay, I looked into it, and the good news is that changing the name of the category from ClangFormat to clang-format doesn't reset the previously saved changes made in the options menu. I also changed the menu item names. Here's what both would look like:

F3119242: pasted_file <https://reviews.llvm.org/F3119242>

F3119244: pasted_file <https://reviews.llvm.org/F3119244>

Now having said that, I'm not sure if this is the best change because of a few things:

1. The extension's name itself is ClangFormat, which was recently added to the Visual Studio market place here: https://marketplace.visualstudio.com/items?itemName=HansWennborg.ClangFormat . Consequently, the extension appears with this name in the Visual Studio extensions dialog: F3119249: pasted_file <https://reviews.llvm.org/F3119249>. I don't think it would be easy to change this. You cannot really take down an extension page on the marketplace once it's there; you'd have to document that it has been deprecated and provide a link to a new page. When searching for it in the Extensions dialog in VS, though, both the old and new extension would show up.

2. Although the name of the executable is indeed "clang-format", the documentation here <http://clang.llvm.org/docs/ClangFormat.html> uses the name ClangFormat: F3119251: pasted_file <https://reviews.llvm.org/F3119251>

So I leave it up to you whether you really want this change or not. We can also decide later rather than fold it into this change.


https://reviews.llvm.org/D29221





More information about the cfe-commits mailing list