Fuzzy file opening in vscode - visual-studio-code

I am exploring vscode after using atom for a long while. One of the things I'm missing is an equivalent of the lovely package advanced-open-file. Is there something similar to this in vscode?
I found the advanced-new-file extension, but it is only helpful when it comes to new files. I would like to be able to quickly open files from all over my local files (not only the workspace).
Edit: I found the option of workbench.action.quickOpen; but it doesn't allow opening files from the whole file system.

Sorry, but currently the answer is no. The problem is that input box doesn't provide a way to listen to key events:
GitHub issue,
so even the extensions can't do that currently. Here's the comment from advanced-new-file extension creator:
Because VSCode extensions don't yet have the ability to do type-ahead autocomplete within the text input box (See https://github.com/Microsoft/vscode/issues/426), we work around this limitation and provide autocomplete using a two-step workflow of selecting existing path, then providing new filename/path relative to the selection.
The good news is that there is a new API addressing this issue, but it's currently in 'proposed' state and can't be used for published extensions.
One workaround could be typing code -r some/path in integrated terminal and using 'tab' for autocomplete.

The Fuzzy search extension seems to work for me.
It adds a new action to the command palette which allows you to search for files in the current project and open them.

Related

Is it possible to force Quick Open to take a query from the current selection in the editor?

The current editor I have open contains the name of a file or part of the name of a file that I have in my workspace. I want to search for that file by selecting the text of that name from the editor, and then putting that text in the Quick Open search box. Currently, I need to manually copy and paste the text, but I want to have behaviour similar to the cmd + F search box where the selected text from the editor immediately appears in the search bar when it is opened. Is it possible to configure Quick Open to do this as well? Or maybe there is an extension for this?
At the time of this writing, this is currently not configurable.
If you look in the settings, all the settings that allow enabling or disabling this behaviour contain the word "seed" in them: search.seedOnFocus, search.seedWithNearestWord, editor.find.seedSearchStringFromSelection. From my reading/searching, there is no other setting with the word "seed" in it.
I googled "github vscode issues quickopen seed" and found this GitHub feature-request on the VS Code GitHub repo: Fuzzy quick open should use selected text as a starting point #59957 asking for such behaviour to be the default behaviour. The issue didn't get enough support from other users to get added to their backlog (a feature request needs to get a certain number of thumbs up reactions from users within a certain time period after it is created to get considered for implementation), so that feature-request is now closed.
If you want to get such a configuration option, create a feature-request issue ticket. If you want to increase your feature-request's visibility (and therefore its chance of getting enough user support), share a link to it on various programming platforms such as r/vscode.
I didn't find any extensions that do this by googling "vscode marketplace quick open seed" and looking at the top results, but maybe you'll have better luck with different queries.

VSCode Extension - Exclude files of FileSystemProvider from recently opened files

I'm building a vscode extension that proposes changes to the user. The changes are shown in a diff editor, the proposed new content of the file is provided by a FileSystemProvider. The uri used for the scheme file is structured like this:
change://original/path?scheme=file
When I'm openening the toolbar to quickly open files of the current workspace, the file is now enlisted multiple times under the recent files. It isn't even visible, which file is the original and which one is the one provided by my own FileSystemProvider.
How do I avoid my "fake files" being enlisted in the recently opened?
I'm quite sure this is possible, as other extensions like GitLens are able to do this as well, but I can't find out what's the difference and haven't found anything on the documentation of VSCode's Extension API.
Edit: I also noticed, that the diff isn't showing diagnostics data when my extension opens it, but it does when it's opened by Gitlens. So maybe this is more related to the the diff viewer than the file system provider?
As usual, the problem turned out to be of completely different origin. The FileSystemProvider provides different versions of each file, each of which identified by a query parameter. I'm opening the differences between the original file and the modified in vscode's integrated diff viewer.
Turns out, that I forgot to strip the query parameter, when restoring the original file uri from my custom one.
So vscode actually got a different uri for the original file, each time I compared it with another modified version. Seems like VSCode is able to provide content for file uris with a query parameter, but a fails to provide meta as uris mismatch. Once I removed the query parameter from the uri, this was no longer the case and also diagnostic data was available again.

How to run VSCode Code Spell Checker extension on an entire folder?/

Street Side Software's Code Spell Checker is a great VSCode extension to tease out typos. I mainly interact with it on a per source file basis where opening the file in the editor triggers the spell check rundown. Is there some way to enact a spell check on an entire directory, maybe even opening all affected files?
This is not currently possible with the extension but it is still an open ISSUE 376 on plugin's github page so it is possible, in future, this feature might be added.
As an alternative, as suggested in the same issue, you can use cspell utility to spell check project directory.

List of all available commands in VSCode

Where can I find the list of all commands available in VSCode and their description?
I'm only aware of these sources:
In the official docs:
This list which only seems to include a subset of Visual Studio Code commands that you might use with vscode.commands.executeCommand API (why is this only a subset of the full list?)
This other list in the keybindings doc, which also only seems to include a subset of all commands available (I suppose those tied to a default keybinding?)
In the editor itself:
I can see a list of commands when I open the "default keybindings". Many actions are commented out with //, but interestingly I don't think this includes all the commands either (e.g. maximizeOtherEditor isn't listed)
Does VSCode have an official list of commands (commandID's) either in its documentation or in its code base? If not:
What's the closest to it?
What's a good way to navigate the code base to try to find all commands and what they do?
I believe that content of "Preferences: Default Keyboard Shortcuts (JSON)" (command ID workbench.action.openDefaultKeybindingsFile) really shows comprehensive list of all native and extensions-contributed commands VSC knows about at moment when invoked.
This file shows keys from VSC's defaults and extension manifests.
Commands with no suggested defaults are those commented out at the end of file.
Their descriptions (as seen in the Command Palette, Keyboard Shortcuts settings, extension Contributions tab and elsewhere) are supposedly in localization properties and I believe there is currently no way to see them along their respective command IDs in single convenient "localized" list. So for now the only way to read the description of command found in aforementioned JSON is pasting its ID into Keyboard Shortcuts search field. (Would be delighted to be proven wrong.)
In case someone ever fell on this and just wanted a quick-list of VSCode commands to browse through: https://gist.github.com/skfarhat/4e88ef386c93b9dceb98121d9457edbf
If you do, please note the VSCode version and commit. These may well be out of date by the time you read them.

sublime text - eclipse App Explorer equivalent

Hi I wondering if there is the equivalent to an App Explorer in Sublime Text 2.
When using eclipse, I use the App Explorer panel to search by file name.
I have a file naming convention that helps me find files by there functionality within the system.
So say I want to list all files relating to the registration process. I search for "regis" via the App Explorer and get a nice list of the relevant files. This filtered list is available all the time until I search again.
I can use Sublime Text's cmd+p but prefer the above as I can see the folder hierarchy etc.
In essence it is merely a file name filter on the folder list.
Are there any plugins that may give me something similar.
Any help much appreciated.
No, as far as I can tell nothing like this has been implemented in Sublime Text 2. I would suggest opening an issue at Sublime's UserEcho forum.
In the meantime:
Typing "regis" into Sublime's 'GoTo Anything' panel will bring up the files you're looking for, and show you their paths (I realize this doesn't help you with visualizing the hierarchy, but that's as close as it gets).
I use a package called SyncedSideBar - this will at least show you a visual representation of the folder hierarchy in the sidebar, for the open file, if it's added to the project.
The GoTo Folder package by freewizard may do something similar to what you're looking for, but I had trouble getting it to work. Maybe you'll have more success.
Good luck!