-
Notifications
You must be signed in to change notification settings - Fork 9
perf: memory efficiency and performance #29
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| // TODO: i do not see any completion functionality in this file. nothing is being provided for the defined commands of these package managers. this is a blocker for release. every each of them should be handled. | ||
| import { Completion } from '../src/index.js'; | ||
|
|
||
| const noopCompletion = async () => []; | ||
|
|
||
| export function setupCompletionForPackageManager( | ||
| packageManager: string, | ||
| completion: Completion | ||
|
|
@@ -20,50 +22,49 @@ export function setupCompletionForPackageManager( | |
| } | ||
|
|
||
| export function setupPnpmCompletions(completion: Completion) { | ||
| completion.addCommand('add', 'Install a package', [], async () => []); | ||
| completion.addCommand('remove', 'Remove a package', [], async () => []); | ||
| completion.addCommand('add', 'Install a package', [], noopCompletion); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i thought descriptions were being retrieved from the package managers themselves as we talked. we should not do that manually. |
||
| completion.addCommand('remove', 'Remove a package', [], noopCompletion); | ||
| completion.addCommand( | ||
| 'install', | ||
| 'Install all dependencies', | ||
| [], | ||
| async () => [] | ||
| noopCompletion | ||
| ); | ||
| // TODO: empty functions should be replaced with noop functions rather than creating that many empty functions | ||
| completion.addCommand('update', 'Update packages', [], async () => []); | ||
| completion.addCommand('exec', 'Execute a command', [], async () => []); | ||
| completion.addCommand('run', 'Run a script', [], async () => []); | ||
| completion.addCommand('publish', 'Publish package', [], async () => []); | ||
| completion.addCommand('test', 'Run tests', [], async () => []); | ||
| completion.addCommand('build', 'Build project', [], async () => []); | ||
| completion.addCommand('update', 'Update packages', [], noopCompletion); | ||
| completion.addCommand('exec', 'Execute a command', [], noopCompletion); | ||
| completion.addCommand('run', 'Run a script', [], noopCompletion); | ||
| completion.addCommand('publish', 'Publish package', [], noopCompletion); | ||
| completion.addCommand('test', 'Run tests', [], noopCompletion); | ||
| completion.addCommand('build', 'Build project', [], noopCompletion); | ||
| } | ||
|
|
||
| export function setupNpmCompletions(completion: Completion) { | ||
| completion.addCommand('install', 'Install a package', [], async () => []); | ||
| completion.addCommand('uninstall', 'Uninstall a package', [], async () => []); | ||
| completion.addCommand('run', 'Run a script', [], async () => []); | ||
| completion.addCommand('test', 'Run tests', [], async () => []); | ||
| completion.addCommand('publish', 'Publish package', [], async () => []); | ||
| completion.addCommand('update', 'Update packages', [], async () => []); | ||
| completion.addCommand('start', 'Start the application', [], async () => []); | ||
| completion.addCommand('build', 'Build project', [], async () => []); | ||
| completion.addCommand('install', 'Install a package', [], noopCompletion); | ||
| completion.addCommand('uninstall', 'Uninstall a package', [], noopCompletion); | ||
| completion.addCommand('run', 'Run a script', [], noopCompletion); | ||
| completion.addCommand('test', 'Run tests', [], noopCompletion); | ||
| completion.addCommand('publish', 'Publish package', [], noopCompletion); | ||
| completion.addCommand('update', 'Update packages', [], noopCompletion); | ||
| completion.addCommand('start', 'Start the application', [], noopCompletion); | ||
| completion.addCommand('build', 'Build project', [], noopCompletion); | ||
| } | ||
|
|
||
| export function setupYarnCompletions(completion: Completion) { | ||
| completion.addCommand('add', 'Add a package', [], async () => []); | ||
| completion.addCommand('remove', 'Remove a package', [], async () => []); | ||
| completion.addCommand('run', 'Run a script', [], async () => []); | ||
| completion.addCommand('test', 'Run tests', [], async () => []); | ||
| completion.addCommand('publish', 'Publish package', [], async () => []); | ||
| completion.addCommand('install', 'Install dependencies', [], async () => []); | ||
| completion.addCommand('build', 'Build project', [], async () => []); | ||
| completion.addCommand('add', 'Add a package', [], noopCompletion); | ||
| completion.addCommand('remove', 'Remove a package', [], noopCompletion); | ||
| completion.addCommand('run', 'Run a script', [], noopCompletion); | ||
| completion.addCommand('test', 'Run tests', [], noopCompletion); | ||
| completion.addCommand('publish', 'Publish package', [], noopCompletion); | ||
| completion.addCommand('install', 'Install dependencies', [], noopCompletion); | ||
| completion.addCommand('build', 'Build project', [], noopCompletion); | ||
| } | ||
|
|
||
| export function setupBunCompletions(completion: Completion) { | ||
| completion.addCommand('add', 'Add a package', [], async () => []); | ||
| completion.addCommand('remove', 'Remove a package', [], async () => []); | ||
| completion.addCommand('run', 'Run a script', [], async () => []); | ||
| completion.addCommand('test', 'Run tests', [], async () => []); | ||
| completion.addCommand('install', 'Install dependencies', [], async () => []); | ||
| completion.addCommand('update', 'Update packages', [], async () => []); | ||
| completion.addCommand('build', 'Build project', [], async () => []); | ||
| completion.addCommand('add', 'Add a package', [], noopCompletion); | ||
| completion.addCommand('remove', 'Remove a package', [], noopCompletion); | ||
| completion.addCommand('run', 'Run a script', [], noopCompletion); | ||
| completion.addCommand('test', 'Run tests', [], noopCompletion); | ||
| completion.addCommand('install', 'Install dependencies', [], noopCompletion); | ||
| completion.addCommand('update', 'Update packages', [], noopCompletion); | ||
| completion.addCommand('build', 'Build project', [], noopCompletion); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is not an efficiency and performance win, it's more like a syntactic optimization.
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.
@Aslemammad, I mean, if we think technically (though it’s a very small difference), the inlined way creates more memory allocations, and more allocations technically mean slightly less efficient memory usage.
but yeah we won’t see a real performance or memory impact either way in this case!