-
Notifications
You must be signed in to change notification settings - Fork 37.2k
Use executable bit when completing commands in terminal suggest #285578
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR adds support for the executable bit in the file system API and uses it to filter terminal command completions on Unix-like systems. When completing the first word of a terminal command (the command position), only executable files are now shown as suggestions, improving the relevance of completions.
Key changes:
- Added
FilePermission.Executableenum value and correspondingexecutablefield to file stat interfaces - Updated the disk file system provider to detect executable permissions from Unix file mode bits
- Modified terminal completion service to filter non-executable files when completing commands on Unix systems
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/platform/files/common/files.ts |
Added Executable enum value to FilePermission and executable field to IBaseFileStat and IFileStatWithMetadata interfaces |
src/vs/platform/files/common/fileService.ts |
Updated toFileStat to extract executable permission from stat permissions |
src/vs/platform/files/node/diskFileSystemProvider.ts |
Implemented detection of executable permission by checking Unix file mode bits (S_IXUSR, S_IXGRP, S_IXOTH) |
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionService.ts |
Added command position detection and executable file filtering logic for Unix systems |
src/vs/workbench/api/common/extHostNotebook.ts |
Added executable field to file stats returned from notebook save operations |
src/vs/workbench/test/common/workbenchTestServices.ts |
Updated createFileStat test helper to include executable: false |
src/vs/workbench/test/browser/workbenchTestServices.ts |
Added executable: false to test file stat mock |
src/vs/workbench/services/workingCopy/test/browser/storedFileWorkingCopy.test.ts |
Added executable: false to test file stat |
src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.ts |
Added executable: false to file stats created in working copy operations |
src/vs/workbench/services/textfile/common/textFileEditorModel.ts |
Added executable: false to file stats in text file editor model |
src/vs/workbench/services/history/test/browser/historyService.test.ts |
Added executable: false to test file stat |
src/vs/workbench/services/editor/test/browser/editorService.test.ts |
Added executable: false to test file stat |
src/vs/workbench/contrib/chat/test/electron-browser/tools/builtinTools/fetchPageTool.test.ts |
Added executable: false to test file stat |
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionService.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionService.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/terminalContrib/suggest/browser/terminalCompletionService.ts
Show resolved
Hide resolved
|
@bpasero could you review since I touch a bunch of file service stuff? |
bpasero
left a comment
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.
Looks good to me generally, but any chance we could add a test for this to the src/vs/platform/files/test/node/diskFileService.integrationTest.ts suite?. I could think of running it only on POSIX and tampering with the mode on a temporary file and then checking if the relevant executable flag is coming back properly.
Co-authored-by: Benjamin Pasero <[email protected]>
Part of #285577