-
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
Add ability to configure task #4714
Conversation
@@ -743,8 +743,125 @@ declare module monaco.quickOpen { | |||
setShowBorder(showBorder: boolean): void; | |||
getEntry(): QuickOpenEntry | undefined; | |||
} | |||
|
|||
export interface INextIterator<T> { |
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.
please expose only what is used and remove everything what is not used in this PR
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.
Removed
next(): T | null; | ||
} | ||
|
||
export interface ITree { |
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.
Could we avoid exposing it?
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.
Removed
68884dc
to
4e53d4e
Compare
@akosyakov I removed all extra objects and updated the PR. Could you review? |
@RomanNikitenko monaco code looks good, thank you 👍 will test in the afternoon, @elaihau could you test as well when you have a chance, you know more about tasks |
); | ||
|
||
this.actionProvider = this.items.length ? this.taskActionProvider : this.noActionProvider; |
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.
Do we need NoActionProvider
? How about assigning undefined
instead?
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.
I used NoActionProvider
to avoid potential NPE, but I reviewed code - we have check, so I removed this entry.
@RomanNikitenko Do I understand correctly that it's basically cover this section of VS Code: https://code.visualstudio.com/Docs/editor/tasks#_customizing-autodetected-tasks So I can test it against grunt built-in extension for example? |
It works nicely for
Also icon is different, is there a way to reuse from VS Code? You don't need to wait for CQ to be approved, but have to file one if you copy an icon. It would be approved eventually, everything in VS Code is under MIT. |
There are also visual differences to VS Code. It would be nice to align, but separately. cc @elaihau
|
import { QuickOpenBaseAction, QuickOpenActionProvider, QuickOpenAction } from '@theia/core/lib/browser/quick-open/quick-open-action'; | ||
|
||
@injectable() | ||
export class ConfigureTaskAction extends QuickOpenBaseAction { |
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.
please keep file named after main class, i.e. task-action-provider.ts
, it is a part of naming conventions for Theia to simplify searching classes by file names
please have a look at other files and rename where it is appropriate
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.
task-action.ts
---> task-action-provider.ts
quick-open-action.ts
---> quick-open-action-provider.ts
Yes we can. Sorry I am in the team training today, will test once it is done. |
protected actionRadio: boolean; | ||
|
||
constructor( | ||
@unmanaged() id: string, |
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.
you could use Options
pattern like for QuickOpenItem
: https://github.com/theia-ide/theia/blob/7edb5f2e9a94272360404d0f48f9a1b88989e9b1/packages/core/src/browser/quick-open/quick-open-model.ts#L54
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
enabled: boolean; | ||
checked: boolean; | ||
radio: boolean; | ||
// tslint:disable-next-line:no-any |
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.
run(event?: { item?: QuickOpenItem }): PromiseLike<any>;
would it be correct type?
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: I added MonacoQuickOpenAction
to provide ability to use QuickOpenItem
here
} | ||
|
||
export interface QuickOpenActionProvider { | ||
// tslint:disable-next-line:no-any |
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.
hasActions(item: QuickOpenItem): boolean;
getActions(item: QuickOpenItem): Promise<QuickOpenAction[]>;
Would it be correct item type?
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
|
||
import { injectable, inject } from 'inversify'; | ||
import { TaskService } from './task-service'; | ||
import { QuickOpenBaseAction, QuickOpenActionProvider, QuickOpenAction } from '@theia/core/lib/browser/quick-open/quick-open-action'; |
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.
It would be nice to reexport them in @theia/core/lib/browser/quick-open
.
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
super('configure:task', '', 'fa fa-cog'); | ||
} | ||
|
||
// tslint:disable-next-line:no-any |
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.
async run(event?: { item: QuickOpenItem }): Promise<void> {
if (event && event.item instanceof TaskRunQuickOpenItem) {
?
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
registry.registerCommand( | ||
TaskCommands.TASK_CONFIGURE, | ||
{ | ||
isEnabled: () => true, |
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.
bwt isEnabled
is true
by default as well as isVisible
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.
Removed
@@ -56,7 +58,11 @@ export class TaskConfigurations implements Disposable { | |||
|
|||
constructor( | |||
@inject(FileSystemWatcher) protected readonly watcherServer: FileSystemWatcher, | |||
@inject(FileSystem) protected readonly fileSystem: FileSystem | |||
@inject(FileSystem) protected readonly fileSystem: FileSystem, | |||
@inject(WorkspaceService) protected readonly workspaceService: WorkspaceService, |
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.
please add new dependenices always vis property injection, otherwise it is a breaking change, see inversify conventions : https://github.com/theia-ide/theia/wiki/Coding-Guidelines#property-injection
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.
Fixed, thank you!
one thing that i found was, the "configure task" button put everything in the task object into task.json, regardless of the place that the task comes from. this is what vscode does for configuring detected tasks: And this is theia (same workspace & same task): in spite of the difference / inconsistency, i would say we could probably leave it to the future PRs to resolve, as we are not supporting the problem matchers, problem patterns, or task definitions at the moment. we will need to pass more information through plugin-ext, and i am currently working on it. |
@elaihau ok, would be good to have follow-up issues for #4714 (comment), #4714 (comment) and #4714 (comment) that all these things get fixed eventually |
@akosyakov @elaihau thank you for your comments, I will fix and update the PR today. |
Changes:
please see the short video https://youtu.be/Hhlls33wqmQ btw, where I should create CQ for VS code icon? Do you have some template/sample? |
CHANGELOG.md
Outdated
@@ -5,6 +5,7 @@ | |||
- [cpp] added new clang-tidy and clang-tidy-checks preferences to lint cpp program when clangd v9+ is used. | |||
- [plugin] `workspace.openTextDocument` API now respects the contributed `FileSystemProviders` | |||
- [search-in-workspace] added a new preference `search.lineNumbers` to control whether to show line numbers for search results. | |||
- [task] added support to configure tasks |
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.
please move to 0.6.0
|
||
getDescription(): string { | ||
if (this.task._scope) { | ||
return new URI(this.task._scope).path.toString(); |
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.
use LabelProvider.getLongName
to get human readable representation of a URI relative the workspace
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
|
||
const resource = await this.resourceProvider(new URI(configFileUri)); | ||
if (resource.saveContents) { | ||
await resource.saveContents(JSON.stringify({ tasks: preparedTasks }, undefined, 4)); |
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 should try to preserve formatting, like here: https://github.com/theia-ide/theia/blob/3886397750b34e6cb65976578c4eb848639adfae/packages/workspace/src/browser/workspace-service.ts#L363-L364
You can use Resource.save
and provide delta as well as full context. It knows when apply what.
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.
just tested, changing tasks.json and then configuring a new task via Run Task
breaks user formatting
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
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.
it works well, except breaking formatting #4714 (comment)
Please take case about it and merge. I would open an issue for remaining UI improvements.
@elaihau is it fine from your side?
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.
looks good to me, thank you !
2d4537e
to
6ee2014
Compare
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
6ee2014
to
1047237
Compare
Add ability to configure Task:
'Configure Tasks' menu action displays only provided tasks.
'Run Task' action displays both: configured and filtered provided tasks. Provided tasks are filtered by label: for example, when we have configured and provided tasks with the same label - only configured task is displayed (provided task is still available from 'Configure Tasks' menu)
'Configure task' action allows to copy task configuration to tasks.json file and provides ability to edit this one. Config file will be created if this one does not exist.
Please see a short demo: https://youtu.be/FKkSnWJy2ac
Related issue: eclipse-che/che#12712
Signed-off-by: Roman Nikitenko rnikiten@redhat.com