-
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
7589-file-search-preview #8735
7589-file-search-preview #8735
Conversation
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.
@danarad05 unfortunately, @theia/search-in-workspace
should not be coupled with @theia/editor-preview
. With these changes, a new coupling is created (without being listed as a dependency), and downstream applications now unnecessarily pull @theia/editor-preview
into their application.
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 see the pull-request was updated, but @theia/search-in-workspace
should not pull @theia/editor-preview
, we do not want to introduce coupling.
@vince-fugnitto
|
Sure, from the beginning we wanted the framework to be modular in a way that application developers can control which extensions are included in their overall applications, and the possibility to not include certain extensions (for example The same is true from the
The goal is not to copy the code/functionality into another package, but implement something similar to the #7589 (comment). The idea would be if an application includes |
@vince-fugnitto are you saying that @danarad05 should set the |
That is the ultimate goal yes (as expressed in the original issue), to use the contributed functionality to preview editors rather than introduce a new hard dependency and coupling between extensions. We can likely inspire ourselves from the |
6defaff
to
f2a523c
Compare
@vince-fugnitto @marechal-p |
packages/search-in-workspace/src/browser/search-in-workspace-result-tree-widget.tsx
Outdated
Show resolved
Hide resolved
@vince-fugnitto Please review, thanks. |
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 are a few issues with the behavior when performing a search & replace
.
The behaviour is buggy, and the editor title is not correctly rendered:
The following is when performing a double click
:
The following is when performing a single click
:
It would be good to confirm the issues on your side as well.
The initial "request changes" due to coupling has been resolved.
packages\core\src\browser\tree\tree-widget.tsx:
Please review again. |
f361a2f
to
d67fb58
Compare
@vince-fugnitto awaiting your review. Thanks |
I believe it is related to #8168 (comment), and in the comment it is expressed to not use |
@vince-fugnitto First, in regard to @akosyakov remark: a) Anton doesn't say - IMO - that we shouldn't do it all but that we should be carefull implementing timeout solutions and that timeouts could mislead users. Second, if we keep onclick and ondoubleclick on same node - there is no other solution as I see it than to use a timer. My solution here is to add a timer which will check for a set period of time - 250ms in this case - to wait if an additional click has been done - if not proceed with onclick handler. IMO this solution is less of an "impact" than a setTimeout that is added in order to manipulate rendering like for here instance:
Third, another option is to place ondoubleclick on child element of node and catch and preventdefault on it. I could try that but I would have to say that IMO that is a "riskier" change because it could create issues and would need to be tested well. Of course it could work well but it is a little riskier (IMO) because it changes functionality that is already tested for some time. Thanks, |
@akosyakov @kittaakos would you mind providing feedback for the pull-request as well? My main concerns were #8168 (comment) and how the changes (which impact |
@vince-fugnitto bump |
@danarad05 I've already expressed my concerns #8735 (comment). It would be good to rebase the pull-request and have others review as well. |
replace result in editor mode. Signed-off-by: Dan Arad <dan.arad@sap.com>
d67fb58
to
39d4e2d
Compare
Rebased. Thanks |
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 have a few comments on the functionality here. For the most part it's working pretty well. I still see some tabbar flashing when I do a double-click open in Electron, but I don't think that's the fault of the code here.
I don't find the delay on a single-click event disturbing, but I don't think that code belongs in this PR. There are other PR's aiming to solve the same problem regarding opening files (#9518, #8913) and I think if we want to have a more general solution, we could write a generalizable click-event adapter that takes two listeners and decides which to invoke depending on whether it receives a single or double click, but that wouldn't belong in the TreeWidget
code either - it would be a generally available utility.
If you take the click event code out, then there isn't much to object to here, and I think it gets in without a problem.
const opener = await this.openerService.getOpener(fileUri, opts); | ||
const editorWidget = await opener.open(fileUri, opts) as EditorWidget; |
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.
These can be replaced by a single call to the open()
function available from '@theia/core/lib/browser'
@@ -985,10 +993,15 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { | |||
mode: 'reveal' |
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.
If we want to mimic the behavior of the Navigator's opening, this should be mode: preview ? 'reveal' : 'activate'
. Alternatively, mode
can be omitted: the EditorManager
will activate
, the EditorPreviewManager
will reveal
.
@@ -971,7 +979,7 @@ export class SearchInWorkspaceResultTreeWidget extends TreeWidget { | |||
fileUri = new URI(node.fileUri); | |||
} | |||
|
|||
const opts: EditorOpenerOptions | undefined = !DiffUris.isDiffUri(fileUri) ? { | |||
let opts: EditorOpenerOptions | undefined = !DiffUris.isDiffUri(fileUri) ? { |
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.
The conditions for deciding whether to show a diff widget (l. 974 - GitHub won't let me comment on old code) produce some weird behavior. Single clicking will open a diff widget, but double-clicking will open a normal editor. That isn't consistent with VSCode, but might be desirable. VSCode has read-write diff widgets where you can edit the right side, but we don't (seem to), so if you want to edit the file, you need a way to open it in a normal editor. Still, if the focus of the PR is fixing the preview vs. non-preview behavior, it might be worth seeing whether we can closer to VSCode's behavior.
Signed-off-by: Dan Arad dan.arad@sap.com
What it does
Fixes #7589
How to test
Review checklist
Reminder for reviewers