Custom Quick OpenCustom Quick Open opens VS Code Quick Open with a useful token extraction modes that the default Quick Open doesn't support. It provides a behavior similar to find-in-files by extracting a token either from the current selection or from the token under the cursor and prefilling Quick Open with it. The extension exposes a command for each extraction mode, so different commands can be used in different contexts, depending on the user's needs and/or the editor's state. Path-like token extractionEnvironment detectionThe extension detects the environment in which VS Code is running to determine the appropriate path separator rules. It uses different path separator rules depending on the environment. The following table summarizes the path separator rules:
A valid path-like token must not contain mixed path separators. For example, POSIX path tokensPOSIX mode uses Examples:
Windows path tokensWindows mode supports either Examples accepted:
Examples rejected as path tokens:
Path component rulesPath components may contain:
The components The extension intentionally does not use Single-component tokensSingle-component unquoted tokens are handled conservatively because spaces make them ambiguous. Accepted as path-like tokens:
Rejected as path-like tokens:
Quoted or backticked single-component tokens with spaces are accepted:
If no path-like token is found, the extension falls back to VS Code's normal word-under-cursor behavior. CommandsOpen from Selection or TokenCommand ID
DescriptionThis command opens Quick Open with a token extracted from the current selection or from the token under the cursor, while simultaneously validating the path token does not contain mixed path separators. BehaviorWhen the command runs, it tries the following sources in order:
If none of the above sources yield a usable token, the command falls back to opening Quick Open with no arguments, which is equivalent to the default Quick Open behavior. Selection handlingIf text is selected:
Examples accepted:
Examples ignored:
Multi-line selections are ignored because Quick Open expects a single query string. Token extractionIf no usable selection exists, the extension tries to extract a path-like token from the current line. The token is always extracted from the same line as the cursor. It never crosses line boundaries. Default shortcutWindows/Linux:
macOS:
This is a key chord. Because it starts with Open Python Module from Selection or TokenCommand ID
DescriptionThis command extracts a python module name from the current selection or from the word under the cursor (with custom regex rules), normalizes it to a path, and opens Quick Open prefilled with the normalized path. BehaviorWhen the command runs, it tries the following sources in order:
If none of the above sources yield a usable token, the command falls back to opening Quick Open with no arguments, which is equivalent to the default Quick Open behavior. Selection handlingIf text is selected:
Examples accepted:
Examples rejected:
Token extractionA token is validated to match the regex Default shortcutWindows/Linux:
macOS:
This is a key chord. Because it starts with InstallationTo install the extension, you can either:
Requirements
RepositoryLicenseMIT. Author
|