-
Notifications
You must be signed in to change notification settings - Fork 337
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 formatMultipleRanges to DocumentRangeFormattingFeature #1253
Conversation
Couple of comments:
To get it work I would do the following:
The reason here is that we need to ship the typings file as well since otherwise other users can't compile against the library. |
Sounds good. I was just looking at past discussions. Initially we were thinking of putting additional ranges in the formatting options but VSCode's API sync resulted in parallel functions exposed on that API. Any opinion over whether the formatting options should be modified to include ranges, if a new formatting method ( |
I would got with a new request textDocument/rangesFormatting. I am not a bug fan of having this encoded in the options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we add a capability to an existing client feature we should add a corresponding capability to the formatting client capabilities. A good name would be multipleRangesSupport: boolean
or rangesSupport: boolean
.
@@ -3448,10 +3448,34 @@ export interface DocumentRangeFormattingParams extends WorkDoneProgressParams { | |||
options: FormattingOptions; | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
protocol/src/common/protocol.ts
Outdated
/** | ||
* Whether the server supports formatting multiple ranges at once. | ||
*/ | ||
canFormatMultipleRanges?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make things consitent with other name and the client capability I would name it multipleRangesSupport
or rangesSupport
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Otherwise (as always) great PR. |
Cheers! Thanks for the reviews |
PR looks good. @c-claeys are you providing a spec change as well? |
Sure, happy to follow up with a spec change PR |
Add multirange formatting support via new request textDocument/rangesFormatting
This does nothing besides breaknpm run compile
ATM, but I'm looking for advice. Am I missing some hook to correctly include the proposed API? I received the proposed .d.ts vianpx vscode-dts dev
, butcompile
doesn't seem to pick it up AFAICT.