-
Notifications
You must be signed in to change notification settings - Fork 36.7k
leverage Fig's shell parser, add git spec
#240001
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
Conversation
Co-authored-by: Daniel Imms <[email protected]>
Co-authored-by: Daniel Imms <[email protected]>
| script: [ | ||
| "bash", | ||
| "-c", | ||
| "git --no-optional-locks status --short | sed -ne '/^M /p' -e '/A /p'", |
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 3 cases that use | sed which will fail currently on Windows. Created #240031 to fix and upstream the change
| const AWS_SPECS = ["aws", "q"]; | ||
| const UNIX_SPECS = [ | ||
| "cd", | ||
| "git", | ||
| "rm", | ||
| "ls", | ||
| "cat", | ||
| "mv", | ||
| "ssh", | ||
| "cp", | ||
| "chmod", | ||
| "source", | ||
| "curl", | ||
| "make", | ||
| "mkdir", | ||
| "man", | ||
| "ln", | ||
| "grep", | ||
| "kill", | ||
| ]; | ||
| const EDITOR_SPECS = ["code", "nano", "vi", "vim", "nvim"]; | ||
| const JS_SPECS = ["node", "npm", "npx", "yarn"]; | ||
| const MACOS_SPECS = ["brew", "open"]; | ||
| const OTHER_SPECS = ["docker", "python"]; | ||
|
|
||
| export const MOST_USED_SPECS = [ | ||
| ...AWS_SPECS, | ||
| ...UNIX_SPECS, | ||
| ...EDITOR_SPECS, | ||
| ...JS_SPECS, | ||
| ...MACOS_SPECS, | ||
| ...OTHER_SPECS, | ||
| ]; |
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.
This might feed into their sorting?
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.
| filesRequested = true; | ||
| foldersRequested = true; |
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.
| { input: `${executable} --list-extensions |`, expectedCompletions: codeSpecOptions, expectedResourceRequests: { type: 'both', cwd: testPaths.cwd } }, | ||
| { input: `${executable} --show-versions |`, expectedCompletions: codeSpecOptions, expectedResourceRequests: { type: 'both', cwd: testPaths.cwd } }, | ||
| { input: `${executable} --category |`, expectedCompletions: categoryOptions }, | ||
| { input: `${executable} --category a|`, expectedCompletions: categoryOptions.filter(c => c.startsWith('a')) }, |
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.
👍
| // Filtering options should request all options so client side can filter | ||
| { input: 'ls -a|', expectedCompletions: allOptions, expectedResourceRequests: { type: 'both', cwd: testPaths.cwd } }, |
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 this is what fig gives us, we might need to make - a trigger character so that the list is refreshed after - and when one is deleted. #240034
| export function getEnvAsRecord(shellIntegrationEnv: { [key: string]: string | undefined } | undefined): Record<string, string> { | ||
| const env: Record<string, string> = {}; | ||
| if (shellIntegrationEnv) { | ||
| for (const [key, value] of Object.entries(shellIntegrationEnv)) { | ||
| if (typeof value === 'string') { | ||
| env[key] = value; | ||
| } | ||
| } | ||
| } | ||
| return env; | ||
| } |
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.
We can maybe just do an as cast instead?
3578dbb to
7d42085
Compare
- third_party/ is ignored as it's not shipped - fig/ is forked so we own the code and should convert to our style - src/completions/upstream should be untouched upstream files
| * @returns An array of `Suggestion` objects. | ||
| * | ||
| */ | ||
| postProcess?: (out: string, tokens: string[]) => (Suggestion | null)[]; // <-- VS Code edit to make results correct |
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.
@meganrogge I added these comments to the 2 lines where we diverge to we can more easily track it
fixes #239519
fixes #239518
Part of #239515