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

quick palette fixes #4549

Merged
merged 4 commits into from
Mar 15, 2019
Merged

quick palette fixes #4549

merged 4 commits into from
Mar 15, 2019

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Mar 13, 2019

fix #4537

See #4549 (comment) for how to reproduce.

@elaihau
Copy link
Contributor

elaihau commented Mar 13, 2019

This is what i get from the Feb 26 build

Peek 2019-03-13 08-02-old

And this patch:

Peek 2019-03-13 08-03-new

As you can tell from the GIFs, when I searched work I wasn't getting as many results from workspace and search-in-workspace folder, and some results, such as README.md, package.json, and those from .git (which should be ignored), didn't make sense to me.

Not sure if it is caused by the change in this PR.

@vince-fugnitto
Copy link
Member

And this patch:

Peek 2019-03-13 08-03-new

As you can tell from the GIFs, when I searched work I wasn't getting as many results from workspace and search-in-workspace folder, and some results, such as README.md, package.json, and those from .git (which should be ignored), didn't make sense to me.

Not sure if it is caused by the change in this PR.

I can confirm, I noticed the same thing @elaihau mentioned.
I also a slight delay when searching, let's say tasks. The file-results only appear after a short delay, but not sure it's a major issue.

@akosyakov
Copy link
Member Author

akosyakov commented Mar 13, 2019

@elaihau @vince-fugnitto could you double check, i get on master:
Screen Shot 2019-03-13 at 13 51 25

with this PR:
Screen Shot 2019-03-13 at 13 55 19

@elaihau Could be that you confused one with another?

Your search also looks different, it seems that in one case you pressed quick file twice to enable ignored files and another once. Please press once.

@akosyakov
Copy link
Member Author

and those from .git (which should be ignored), didn't make sense to me.

It's the same on master, please open a separate issue.

@elaihau
Copy link
Contributor

elaihau commented Mar 13, 2019

I pulled from master and ran one more test from my local env:

Peek 2019-03-13 09-05

I don't see any entries from .git, or package.json / README.md. So master branch seems fine. I will also test this change from my local env.

@akosyakov
Copy link
Member Author

@elaihau strange and you don't have any custom user settings?

@elaihau
Copy link
Contributor

elaihau commented Mar 13, 2019

you don't have any custom user settings?

not sure. could you please give me a couple of examples of "user settings" ?

@akosyakov
Copy link
Member Author

I meant just in home/youruser/.theia/setting.json, maybe you customize some settings. Files from .gitignore should not appear in search result by default, only if you trigger search twice. But you have them.

@elaihau
Copy link
Contributor

elaihau commented Mar 13, 2019

I don't have search-related prefs in my settings.json:

   "editor.autoSave": "off",
   "editor.lineNumbers": "relative",
   "workspace.supportMultiRootWorkspace": true,
   "typescript.trace.server": "verbose",
   "editor.renderWhitespace": "all",
   "editor.renderIndentGuides": true,
   "editor.fontSize": 14,

I just tested this change in my local env. and everything looks working.
weird thing was I saw different search results from gitpod.

@akosyakov
Copy link
Member Author

I just tested this change in my local env. and everything looks working.

If you trigger file search once you should not see files filtered by .gitignore but you have them on your gifs. It does not look working.

@elaihau
Copy link
Contributor

elaihau commented Mar 13, 2019

If you trigger file search once you should not see files filtered by .gitignore

if i am not mistaken, the .gitignore thing has broken for a long time #1588
i also see similar issues reported on the board of ripgrep. if you search "ignore" from https://github.com/BurntSushi/ripgrep/issues you will see at least a couple.

@AlexTugarev
Copy link
Contributor

Works nicely for commands now! 💯

Screen Shot 2019-03-13 at 14 11 07

Screen Shot 2019-03-13 at 14 11 32

File search works with the .gitignore exception.
a) good cases
Screen Shot 2019-03-13 at 14 14 40
b) should have been filtered, as node_modules is ignored
Screen Shot 2019-03-13 at 14 40 19

I checked with current master state and it's the very same issue:
Screen Shot 2019-03-13 at 14 36 43

@vince-fugnitto
Copy link
Member

@akosyakov I see the problems from master now, I don't what caused it as it was working quite nicely :( your PR does address a lot of the issues and improves it.

I noticed one thing however, do you believe this is a bug from your PR?

Searching for workspace:

Screen Shot 2019-03-13 at 9 40 26 AM

Searching for workspace-:

Screen Shot 2019-03-13 at 9 40 32 AM

As you can see when searching for workspace we don't get the complete set of results, we start getting results which don't truly make sense based on the query. When the search query is workspace- we get the more complete set.

@akosyakov
Copy link
Member Author

akosyakov commented Mar 13, 2019

@elaihau ok, it seems with Gitpod OS, it works a bit better and manages to filter out some ignored files

Anyway, i did not change code around it. It's fixing following issues reproduciable on master:
(1) race condition: try typing shell very fast and you get results like LICENSE which does not match at all and sometimes shell.ts won't match at all when it should
(2) using absolute paths for matching, type shell this time very slow, make sure that shell.ts is among results, but there are also completely bogus results, like logo/theia-logo.svg in Gitpod

The issue with (2) is that we match against /workSpace/tHEia/Logo/theia-Logo.svg, but should only against logo/theia-logo.svg which does not have shell.

With this PR you should not be able to reproduce these issues.

@akosyakov
Copy link
Member Author

akosyakov commented Mar 13, 2019

@vince-fugnitto i think it is all because of #1588. you should not see anything from node_modules and .git and then results should be cleaned. It is for sure something worth to look into.

@akosyakov
Copy link
Member Author

And I also have feeling that it got broken at some point, or we just all so get used to it.

Copy link
Contributor

@elaihau elaihau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what i am getting from my local env (ubuntu 16 + chrome + example browser) looks good.

however when i tested on gitpod it gives me some irrelavent stuffs (e.g., package.json and readme.md) when i search "work". Also, like @vince-fugnitto described, some results from searching workspace- do not show up on the search of workspace.

@akosyakov
Copy link
Member Author

Ok, will give one more round maybe can improve it a bit more.

describe('irrelevant absolute results', () => {
const rootUri = FileUri.create(path.resolve(__dirname, '../../../../..'));

it('not fuzzy', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is a repro for the bogus workspace search results.

        const rootUri = FileUri.create(path.resolve(__dirname, '../../../..'));

        it.only('not fuzzy', async () => {
            const searchPattern = rootUri.path.dir.base;
            const matches = await service.find(searchPattern, { rootUris: [rootUri.toString()], fuzzyMatch: false, useGitIgnore: true, limit: 200 });
            for (const match of matches) {
                const relativUri = rootUri.relative(new URI(match));
                if (relativUri) {
                    const relativMatch = relativUri.toString();
                    assert.notEqual(relativMatch.indexOf(searchPattern), -1, relativMatch);
                }
            }
        });

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elaihau, ☝️ the workspace search pattern is in the path of the bogus search results.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it.only nice feature, did not know it :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just don't forget to remove it ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see it is for vscode extension, i don't think API was modeled properly, there should be a new explicit option for included globs and it should not affect quick file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosyakov this is one example: https://github.com/Microsoft/vscode/blob/master/extensions/npm/src/tasks.ts#L101

npm uses the service to find all packages.json, excluding those from node_modules.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@elaihau elaihau Mar 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be a new explicit option for included globs and it should not affect quick file

i was thinking about the same thing. but after seeing this interface i chose to support the string match & glob match from the same function without having that option. https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/services/search/common/search.ts#L79

export interface IFileQueryProps<U extends UriComponents> extends ICommonQueryProps<U> {
	type: QueryType.File;
	filePattern?: string;

	/**
	 * If true no results will be returned. Instead `limitHit` will indicate if at least one result exists or not.
	 * Currently does not work with queries including a 'siblings clause'.
	 */
	exists?: boolean;
	sortByScore?: boolean;
	cacheKey?: string;
}

maybe you are right, with the new option defined we would have finer grained control over what the service does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elaihau yes, searchPattern and includePatterns are not the same, i've separated them

@akosyakov
Copy link
Member Author

@elaihau @vince-fugnitto @AlexTugarev please try again

VS Code API client also should be tested, what do you expect from npm extension?

@vince-fugnitto
Copy link
Member

@elaihau @vince-fugnitto @AlexTugarev please try again

VS Code API client also should be tested, what do you expect from npm extension?

the builds are failing, and so is the prebuilt gitpod workspace 😞

@akosyakov
Copy link
Member Author

@vince-fugnitto should be good now

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
…4537

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Copy link
Contributor

@AlexTugarev AlexTugarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for fixing this! 💯

@vince-fugnitto
Copy link
Member

@akosyakov sorry I just got a chance to check it now, its still early morning in Montreal 😄

On Gitpod I noticed that everything was fine, however locally I noticed irregularities.
I had many recently opened results, and when searching all these recently opened results persisted, which felt like an error to me. I don't know why it occurs locally and not on Gitpod however.

It might be something to look into.

vid

@akosyakov
Copy link
Member Author

@vince-fugnitto please file an issue, this PR does not touch recently opened at all, but you are right it is worth to look into as well

@vince-fugnitto
Copy link
Member

@vince-fugnitto please file an issue, this PR does not touch recently opened at all, but you are right it is worth to look into as well

I was able to reproduce in Gitpod as well.
I'm completely fine in merging the PR, the changes look great and works great as well !
If anything we can always fix the recently opened in another PR after we track it in an issue.

@akosyakov
Copy link
Member Author

VS Code API client also should be tested, what do you expect from npm extension?

@elaihau is it good for VS Code extension? Could you verify please?

@elaihau
Copy link
Contributor

elaihau commented Mar 14, 2019

VS Code API client also should be tested, what do you expect from npm extension?

@elaihau is it good for VS Code extension? Could you verify please?

testing right now

@elaihau
Copy link
Contributor

elaihau commented Mar 14, 2019

i am getting the following errors in browser:

Uncaught (in promise) TypeError: theiaToken.onCancellationRequested is not a function
    at WorkspaceMainImpl.<anonymous> (:3000/82.bundle.js:14076)
    at step (:3000/82.bundle.js:13938)
    at Object.next (:3000/82.bundle.js:13919)
    at :3000/82.bundle.js:13913
    at new Promise (<anonymous>)
    at push.../../packages/plugin-ext/lib/main/browser/workspace-main.js.__awaiter (:3000/82.bundle.js:13909)
    at WorkspaceMainImpl.push.../../packages/plugin-ext/lib/main/browser/workspace-main.js.WorkspaceMainImpl.$startFileSearch (:3000/82.bundle.js:14053)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.doInvokeHandler (:3000/82.bundle.js:835)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.invokeHandler (:3000/82.bundle.js:820)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.receiveRequest (:3000/82.bundle.js:784)

i will see if i can find where it went wrong

@elaihau
Copy link
Contributor

elaihau commented Mar 14, 2019

line 174 of workspace-main.ts is where it failed. the function call didn't reach the file-search-service, and stopped in the plugin-ext

        if (theiaToken) {
            theiaToken.onCancellationRequested(() => source.cancel());
        }
command.ts:15 Uncaught (in promise) TypeError: theiaToken.onCancellationRequested is not a function
    at WorkspaceMainImpl.<anonymous> (workspace-main.ts:174)
    at step (workspace-main.ts:15)
    at Object.next (workspace-main.ts:15)
    at workspace-main.ts:15
    at new Promise (<anonymous>)
    at push.../../packages/plugin-ext/lib/main/browser/workspace-main.js.__awaiter (workspace-main.ts:15)
    at WorkspaceMainImpl.push.../../packages/plugin-ext/lib/main/browser/workspace-main.js.WorkspaceMainImpl.$startFileSearch (workspace-main.ts:156)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.doInvokeHandler (rpc-protocol.ts:216)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.invokeHandler (rpc-protocol.ts:201)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.receiveRequest (rpc-protocol.ts:157)

@akosyakov
Copy link
Member Author

@elaihau good, please describe which extension do you install and what you do

maxResults?: number, token?: theia.CancellationToken): Promise<UriComponents[]> {
const opts: FileSearchService.Options = { rootUris: this.roots.map(r => r.uri) };
async $startFileSearch(includePattern: string, includeFolderUri: string | undefined, excludePatternOrDisregardExcludes?: string | false,
maxResults?: number, theiaToken?: theia.CancellationToken): Promise<UriComponents[]> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benoitf @evidolob Is cancellation hooked into plugin RCP? from #4549 (comment) it looks like not. Is there another way to cancel?

Copy link
Contributor

@elaihau elaihau Mar 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, this is what vscode does from the extension host:

		if (token && token.isCancellationRequested) {
			return Promise.resolve([]);
		}

		return this._proxy.$startFileSearch(includePattern, includeFolder, excludePatternOrDisregardExcludes, maxResults, token)
			.then(data => Array.isArray(data) ? data.map(URI.revive) : []);

code is from extHostWorkspace.ts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know, but it does not seem to work in Theia, i would need to check

…h root

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
@akosyakov
Copy link
Member Author

akosyakov commented Mar 14, 2019

@elaihau i've removed cancellation, plugin RCP does not seem to support it, could you try again please

@elaihau
Copy link
Contributor

elaihau commented Mar 14, 2019

describe which extension do you install and what you do

i installed grunt and npm. what i did was run command "run tasks" from the single root workspace where gulp tasks and npm scripts are defined.

i tested again. with the latest change everything from my side worked fine. Thank you !

@akosyakov akosyakov merged commit b21023e into master Mar 15, 2019
@akosyakov akosyakov deleted the GH-4537 branch March 15, 2019 07:00
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.

[open file][find command] Unexpected search results
5 participants