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

Add coc.preferences.formatterExtension configuration #5102

Merged
merged 7 commits into from
Aug 12, 2024

Conversation

statiolake
Copy link
Contributor

This is a proof-of-concept.

  • Registered by extensions itself (like coc-pyright): identified by extension name as expected
  • Registered by extensions through a language client (like @yaegassy/coc-ruff): identified by extension name as expected
  • Registered by coc.nvim for raw LSP languageserver configuration: identified as coc.nvim
    • TODO: So there is no way to select one from multiple LSP - what it should be in this case?

Priorities are still expected to work (when coc.preferences.formatterExtension is null).

Closes #5076

Copy link

codecov bot commented Aug 3, 2024

Codecov Report

Attention: Patch coverage is 65.21739% with 16 lines in your changes missing coverage. Please review.

Project coverage is 98.41%. Comparing base (c5ffbb3) to head (867603a).

Files Patch % Lines
src/provider/formatManager.ts 50.00% 8 Missing ⚠️
src/provider/formatRangeManager.ts 50.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5102      +/-   ##
==========================================
- Coverage   98.47%   98.41%   -0.06%     
==========================================
  Files         273      273              
  Lines       26088    26123      +35     
  Branches     5389     5396       +7     
==========================================
+ Hits        25689    25708      +19     
- Misses        239      255      +16     
  Partials      160      160              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fannheyward
Copy link
Member

I've tested this and works as expected, thank you for your PR, the parseExtensionName function is a gem.

@fannheyward
Copy link
Member

Please add the update to history.md and typings/index.d.ts too.

@statiolake
Copy link
Contributor Author

Thank you for your checking!

For index.d.ts, is it correct understanding that it is listing public APIs of coc.nvim?
If so, it is a good option to keep the public API as-is to "hide" this extra implementation detail; an extension name is not what should be explicitly specified from an extension's side. What do you think? If you think we should include it in index.d.ts, I'll do that. And if to keep the current one, I'll add an explanation to the implementation side why this signature is different from the index.d.ts one.

Also, should I add some tests for this? The problem is that I'm not familiar with neither JavaScript's testing ecosystem nor coc.nvim's testing utilities.

@fannheyward
Copy link
Member

fannheyward commented Aug 12, 2024

OK, let's hide this from the API as the extension name won't be specified, and ignore the tests for now.

@statiolake is there any more work to add?

@statiolake statiolake marked this pull request as ready for review August 12, 2024 10:17
@statiolake statiolake marked this pull request as draft August 12, 2024 10:20
@statiolake
Copy link
Contributor Author

OK, then I won't update index.d.ts and ignore tests for now. But I think I still need to add this new configuration to history.md. I'll do that later today.

@statiolake statiolake marked this pull request as ready for review August 12, 2024 11:49
@statiolake
Copy link
Contributor Author

All done. Please check and merge this if it's OK.

@fannheyward
Copy link
Member

doc/coc-config.txt please

@statiolake
Copy link
Contributor Author

Sorry I didn't notice that. Now fixed.

@fannheyward fannheyward merged commit bf3d1f6 into neoclide:master Aug 12, 2024
3 checks passed
fannheyward added a commit that referenced this pull request Sep 2, 2024
9c25f2f fix(typings): getDocument return type. (#5132)
d4ff928 feat(language-client): modify log time format (#5130)
53e21a9 fix(snippet): deviation in snippet select in the first column (#5104)
0e6a8c7 feat(codeLens): add codeLens.display (#5129)
704295e fix(handler): correct current winid (#5128)
aabfc23 fix: ignore failed config file reads (#5118)
56ea360 feat: expose more properties quick list (#5114)
37f98a1 feat(util): adjust to vim's Patch 9.1.327 (#5122)
80e9f1b chore(package): upgrade micromatch (#5127)
98fa66a chore(packages): lock ESLint versions for now (#5108)
bf3d1f6 Add `coc.preferences.formatterExtension` configuration (#5102)
38697bc chore(handle): typo toggle inlayHint (#5105)
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.

New configuration like VSCode's editor.defaultFormatter
2 participants