Skip to content

feat(pack): add prettier pack #1502

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
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

azdanov
Copy link
Contributor

@azdanov azdanov commented May 17, 2025

Issue #1501

📑 Description

Extracted prettier into separate pack. I'm wondering if I should add support for other languages like html, css, yaml, json etc. Maybe via vim.g.prettier.format_filetypes?

Still need to test it with null_ls and conform to see that it performs similar as before.

ℹ Additional Information

Copy link

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

  • If you are adding a new plugin, the scope would be the name of the category it is being added into. ex. feat(utility): added noice.nvim plugin

  • If you are modifying a pre-existing plugin or pack, the scope would be the name of the plugin folder. ex. fix(noice-nvim): fix LSP handler error

  • Pull request title has the appropriate conventional commit type and scope where the scope is the name of the pre-existing directory in the project as described above

  • README is properly formatted and uses fenced in links with <url> unless they are inside a [title](url)

  • Entry returns a single plugin spec with the new plugin as the only top level spec (not applicable for recipes or packs).

  • Proper usage of opts table rather than setting things up with the config function.

  • Proper usage of specs table for all specs that are not dependencies of a given plugin (not applicable for recipes or packs).

@azdanov azdanov marked this pull request as ready for review May 18, 2025 04:53
@azdanov

This comment was marked as off-topic.

@azdanov

This comment was marked as off-topic.

@azdanov

This comment was marked as outdated.

@azdanov azdanov requested a review from a team May 20, 2025 02:37
It would be better to do this in a separate PR
@azdanov azdanov requested a review from Copilot May 24, 2025 06:59
Copilot

This comment was marked as outdated.

@azdanov azdanov requested review from Uzaaft and removed request for a team June 27, 2025 07:38
@Uzaaft
Copy link
Member

Uzaaft commented Jun 27, 2025

Have you tested it, per the comment you wrote in the PR desc? @azdanov

"yaml",
}

local lsp_rooter_cache, prettierrc_rooter_cache
Copy link
Member

Choose a reason for hiding this comment

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

Why are these needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. I extracted what was there already in the typescript pack without changing much.

return true
end

local conform_formatter = function(bufnr) return has_prettier(bufnr) and { "prettierd" } or {} end
Copy link
Member

Choose a reason for hiding this comment

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

Inline this.

Comment on lines +110 to +113
local null_ls_formatter = function(params)
if vim.tbl_contains(format_filetypes, params.filetype) then return has_prettier(params.bufnr) end
return true
end
Copy link
Member

Choose a reason for hiding this comment

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

Inline this.

@azdanov
Copy link
Contributor Author

azdanov commented Jun 27, 2025

Have you tested it, per the comment you wrote in the PR desc? @azdanov

I'll test run it again next week at work to make sure nothing breaks during daily usage. I did test it when creating the PR, but maybe things changed or I missed something, since I don't use null-ls at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants