-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat(oxlint/oxfmt): adopt and fully integrate the recommended language servers #4242
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
base: master
Are you sure you want to change the base?
Changes from all commits
433887e
697d97c
4984359
81858a4
6ec14a7
1e6346a
a5cb7ae
a59571c
cd32b23
367dcb1
58c62a9
d84b89f
774316a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- @brief | ||
| --- | ||
| --- https://github.com/oxc-project/oxc | ||
| --- https://oxc.rs/docs/guide/usage/formatter.html | ||
| --- | ||
| --- `oxfmt` is a Prettier-compatible code formatter that supports multiple languages | ||
| --- including JavaScript, TypeScript, JSON, YAML, HTML, CSS, Markdown, and more. | ||
| --- It can be installed via `npm`: | ||
| --- | ||
| --- ```sh | ||
| --- npm i -g oxfmt | ||
| --- ``` | ||
|
|
||
| local util = require 'lspconfig.util' | ||
|
|
||
| ---@type vim.lsp.Config | ||
| return { | ||
| cmd = { 'oxfmt', '--lsp' }, | ||
| filetypes = { | ||
| 'javascript', | ||
| 'javascriptreact', | ||
| 'javascript.jsx', | ||
| 'typescript', | ||
| 'typescriptreact', | ||
| 'typescript.tsx', | ||
| 'toml', | ||
| 'json', | ||
| 'jsonc', | ||
| 'json5', | ||
| 'yaml', | ||
| 'html', | ||
| 'vue', | ||
| 'handlebars', | ||
| 'hbs', | ||
| 'css', | ||
| 'scss', | ||
| 'less', | ||
| 'graphql', | ||
| 'markdown', | ||
| 'mdx', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mhh pretty sure it depends on configuration, with v0.11.5 vanilla I don't get any filetype on mdx files. Not sure about how to manage this case. |
||
| }, | ||
| workspace_required = true, | ||
| root_dir = function(bufnr, on_dir) | ||
| local fname = vim.api.nvim_buf_get_name(bufnr) | ||
|
|
||
| -- Oxfmt resolves configuration by walking upward and using the nearest config file | ||
| -- to the file being processed. We therefore compute the root directory by locating | ||
| -- the closest `.oxfmtrc.json` (or `package.json` fallback) above the buffer. | ||
| local root_markers = util.insert_package_json({ '.oxfmtrc.json' }, 'oxfmt', fname)[1] | ||
FLchs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| on_dir(vim.fs.dirname(vim.fs.find(root_markers, { path = fname, upward = true })[1])) | ||
| end, | ||
FLchs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.