oliverschwendener / ueli

Cross-Platform Keystroke Launcher
https://ueli.app
MIT License
3.62k stars 239 forks source link

Visual Studio Code Extension #1157

Closed IrishBruse closed 3 weeks ago

IrishBruse commented 1 month ago

This is a WIP extension that adds the ability to open recent folders and files opened in vscode.

Feedback is welcome thanks.

oliverschwendener commented 1 month ago

Please remove all unrelated changes from this PR.

oliverschwendener commented 1 month ago

There are still changes that seem unrelated to a Visual Studio Code extension, for example in common/Core/Search and renderer/Core/Search.

IrishBruse commented 1 month ago

There was no way to fuzzy find the items so i needed to make that common

oliverschwendener commented 1 month ago

Then please separate this into 2 PRs: one PR for the refactoring of the filtering and on PR for your extension.

IrishBruse commented 4 weeks ago

One issue i need some input on when a file path gets very long it overflows how best do we want to handle this should i shorten it somehow and replace with ... image

oliverschwendener commented 4 weeks ago

Please don't put file paths into the description of the search result items. As you can see all other search resullt items just show short description of what this is, for example "Browser Bookmark" or "Application" or "Workflow".

oliverschwendener commented 3 weeks ago

Is this ready to be merged? For me it looks good, I didn't test it tough.

oliverschwendener commented 3 weeks ago

I forgot to mention: can you please add a readme file for your extension in docs/Extensions/<Extension_ID>/README.md similar to the others? Just quickly explain what it does and how it works.

oliverschwendener commented 3 weeks ago

And I just tested the extension and it seems to fail when one of the recent items is a .code-workspace file.

IrishBruse commented 3 weeks ago

image Code workspace works fine for me its the same with .gitconfig so not an issue with files starting with . whats the error showing up as? Im on linux mint so it might be a windows related bug havent tested on windows or mac yet. But it should support them just fine the only os specific thing is the file location and they were just documented in the vscode docs.

IrishBruse commented 3 weeks ago

Yeah its ready to merge once we figure out that bug on your end

oliverschwendener commented 3 weeks ago

I added a try/catch around URL.fileURLToPath(uri) to find out which recent item is causing the issue:

try {
    path = URL.fileURLToPath(uri);
} catch (error) {
    console.log({ uri, recent, error });
}

This is the error that I got:

{
  uri: undefined,
  recent: {
    workspace: {
      id: '118472e49418a2388512d52628dc6abb',
      configPath: 'file:///Users/oliverschwendener/themes.code-workspace'
    }
  },
  error: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of URL. Received undefined
      at Module.fileURLToPath (node:internal/url:1461:11)
      at VSCodeExtension.getSearchItem (/Users/oliverschwendener/projects/ueli/dist-main/index.js:6074:29)
      at async Promise.all (index 31)
      at async VSCodeExtension.getSearchResultItems (/Users/oliverschwendener/projects/ueli/dist-main/index.js:6046:25)
      at async Promise.allSettled (index 13)
      at async ExtensionManager.populateSearchIndex (/Users/oliverschwendener/projects/ueli/dist-main/index.js:753:28)
      at async /Users/oliverschwendener/projects/ueli/dist-main/index.js:876:19 {
    code: 'ERR_INVALID_ARG_TYPE'
  }
}
IrishBruse commented 3 weeks ago

Havent used workspaces so didnt catch that my bad, no clue why they are stored differently too should work now tested it locally too.

oliverschwendener commented 3 weeks ago

It works now, thanks!

oliverschwendener commented 3 weeks ago

Thanks for your efforts! I sent you an invite to be direct collaborator on this repository. This enables you to directly be notified when someone wants to change something in your extension.