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

Extension claims to have a formatter, but doesn't #515

Closed
hho opened this issue Apr 2, 2023 · 10 comments · Fixed by #606
Closed

Extension claims to have a formatter, but doesn't #515

hho opened this issue Apr 2, 2023 · 10 comments · Fixed by #606
Labels
Area: VsCodeExtension language server more-than-validation New features above and beyond simple YAML validation

Comments

@hho
Copy link

hho commented Apr 2, 2023

(This is a followup to #209 , as requested by @50Wliu)

  1. When trying to format a file marked as azure-pipelines, it doesn't work and VS Code says no formatter for this file type is installed:
    Screenshot_20230402_184022-1

  2. Searching for a formatter in the Marketplace then only results in this very same extension again, because it (falsely) is registered as a formatter there:
    Screenshot_20230402_184208-1

  3. However, when I switch the filetype to YAML instead, this extension does offer a formatter, so if you have another formatter installed, you're being forced to choose one:
    Screenshot_20230402_184318-1

Unfortunately, if you actually do select this extension as the default formatter for YAML, it doesn't work either (no formatting is happening).

The workaround mentioned in the README and on the Marketplace page only seems to work with Prettier, not with the YAML language server from RedHat or other YAML extensions.

Possible fixes:

or

  • Remove the Formatter tag for this extension in the Marketplace
  • Don't register this extension as a YAML Formatter in VS Code
  • Mention that Prettier & manual config is necessary for formatting Azure Pipelines
@DmitriiBobreshev
Copy link
Contributor

DmitriiBobreshev commented Apr 4, 2023

Hi @hho, thank you for the feedback, you're right, and the extension needs an additional formatter installed to be able to format files, it describes on the extensions page in "Document formatting" section. For now Prettier formatter works well. You also could try to use yaml formatted from RedHat but seems like it needs an additional setting to be able to format.

@ggirard07
Copy link

@DmitriiBobreshev Do you have more details about that additional setting for the RedHat formatter?
Because in the issue linked to the extension page you mentioned, no information is available for RedHat, except that it does not work with extension page workaround only.

@jafin
Copy link

jafin commented Jul 13, 2023

As described I have configured the following in the settings.json

  "[azure-pipelines]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },

but VSCode still complains There is no formatter for 'azure-pipelines' files instanned
Clues?

@SpaceOgre
Copy link

I'm having the same issue as @jafin, adding this to my settings.json does not work:

    "[azure-pipelines]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },

@Stuart-Wilcox
Copy link

@jafin @SpaceOgre I also ran into this exact problem, my settings.json looked identical but I got the prompt that no formatter was found. Turns out that prettier task failed to start, and the reason was that the prettier path was looking into my node_modules in the repo to run it. Doing an install with yarn solved it for me.

Check in the bottom bar in VSCode window for Prettier with two checkmarks like this:
image

This is what it was before, and when you click on it you get a debug output indicating the problem
image

@winstliu winstliu added quality-of-life Enhancements that make the extension more joyful to use more-than-validation New features above and beyond simple YAML validation language server and removed quality-of-life Enhancements that make the extension more joyful to use labels Jan 4, 2024
@winstliu
Copy link
Member

winstliu commented Jan 4, 2024

This is on my radar. I assume the YAML formatting is made possible by its language server; if we can similarly update our language server (which was forked from Red Hat's in 2018) to merge in the improvements from the past 5 years, I assume we'll be 95% of the way there to getting formatting working properly.
If it turns out that's going to take a while, I'll temporarily remove the formatter tag.

@milanmpetrovic
Copy link

This is on my radar. I assume the YAML formatting is made possible by its language server; if we can similarly update our language server (which was forked from Red Hat's in 2018) to merge in the improvements from the past 5 years, I assume we'll be 95% of the way there to getting formatting working properly. If it turns out that's going to take a while, I'll temporarily remove the formatter tag.

Any update on this matter maybe? Seems like previous comment/change is not applied effectively yet.

@winstliu
Copy link
Member

winstliu commented Oct 9, 2024

Well, it turns out that merging 5 years' worth of changes back into a codebase that's significantly diverged is quite difficult 😅. I have been making progress, but there's still quite a bit of work to do before it's "ready".

@milanmpetrovic
Copy link

Thank you for the update. I was more hoping to hear about you last sentance about "If it turns out that's going to take a while" remedy :) That would definetly help a lot and looks like a low hanging fruit.

@milanmpetrovic
Copy link

Awesome, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: VsCodeExtension language server more-than-validation New features above and beyond simple YAML validation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants