-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Menu to select default formatter for the document #8446
Menu to select default formatter for the document #8446
Conversation
When I run Theia with the following plugins:
|
@@ -1276,8 +1276,8 @@ export interface LanguagesMain { | |||
$registerQuickFixProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[], codeActionKinds?: string[]): void; | |||
$clearDiagnostics(id: string): void; | |||
$changeDiagnostics(id: string, delta: [string, MarkerData[]][]): void; | |||
$registerDocumentFormattingSupport(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void; | |||
$registerRangeFormattingProvider(handle: number, pluginInfo: PluginInfo, selector: SerializedDocumentFilter[]): void; |
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.
Why renaming these is needed?
Why not keep it in sync with the corresponding VS Code interface.
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.
Aligned with VS Code, thanks!
How do you run Theia? Did you try to run the test script? |
@vitaliy-guliy I used "Option 1" from "How to test" section. |
Could you please describe the steps what exactly are you doing? Did you use fork with fixes? |
@vitaliy-guliy
It would be nice if someone else could try it as well. |
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.
@azatsarynnyy
I tested according to #8446 (comment)
I didn't see such errors.
@vitaliy-guliy
I tried to remove a formatter from preferences to see the dialog about preferred formatter again, but looks like it always uses my first choice and I can not change formatter then.
Could you try this cases?
Does it work for you?
Maybe something wrong on my side...
Update: the problem was on my side - now it works for me and I can select another formatter after removing the previous one.
The only thing which I noticed - quarkus formatter do nothing
After removing preference the menu must appear again. |
Yes, now it works for me - I mentioned above that the problem was on my side
OK, thanks! |
0963cb1
to
90270ad
Compare
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.
After fixing my JDK_HOME
env. var. everything works as expected. Thanks @RomanNikitenko for the hint!
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.
@vitaliy-guliy please, check the failed tests before merging
ec1bee8
to
0a204c4
Compare
'editor.defaultFormatter': { | ||
'type': 'string', | ||
'default': 'default', | ||
'description': 'Default formatter' | ||
}, |
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.
Is there a reason we do not want to support this same schema as vscode, especially the default value (null
)?
I believe it will cause inconsistencies:
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.
PR is updated. For default value I used undefined
, as we cannot use null
. Thanks
lerna ERR! /home/vitaliy/projects/vitaliy-guliy-theia/packages/editor/src/browser/editor-preferences.ts
lerna ERR! 82:20 error Use undefined instead of null no-null/no-null
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.
We could use it if we disable the rule for it, I think in this case it is fine since we want compatibility:
// eslint-disable-next-line no-null/no-null
My only concern is when reading .vscode
settings where they use null
as a value since it is allowed.
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 with
// eslint-disable no-null/no-null
as null
can be used also to initialize other properties
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
add3986
to
d664c3e
Compare
What it does
Adds quick pick menu to select document formatter.
The menu is appeared only when the extensions registered several formatters for the same language.
ID of selected formatter is saved to preferences, so the menu will not appear next time when formatting.
Fixes #8354
How to test
Option 1
Option 2
To test
Review checklist
Reminder for reviewers