-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Added command history #2115
Added command history #2115
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.
Haven't looked in depth just quick comment
packages/cursorless-vscode/src/ide/vscode/VscodeCommandHistory.ts
Outdated
Show resolved
Hide resolved
packages/cursorless-vscode/src/ide/vscode/VscodeCommandHistory.ts
Outdated
Show resolved
Hide resolved
… into commandHistory
@pokey Updated and ready ;) |
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! Left a few comments. Also
- I think it would be nice to have at least one simple sunny-day test. You should be able to steal most of what you need from https://github.com/cursorless-dev/cursorless/blob/main/packages/cursorless-vscode-e2e/src/suite/testCaseRecorder.vscode.test.ts
I can't find the mechanism for mocking the file system paths. |
The cursorless dir is already automatically set to a temp dir cursorless/packages/cursorless-vscode/src/extension.ts Lines 175 to 177 in 40a6fee
Lines 12 to 13 in 40a6fee
|
Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>
We don't really have the command id at this point in the pipeline, but I guess we could just use the constant with the knowledge that it will be correct? True sounds reasonable to test. |
No I just mean generate one on the fly
Just generate an id, then use command server api to see if the phrase has changed, like we do for hat map, and if not reuse previous phrase id otherwise generate new one. Make sense? |
Okay how would that id look and what would be the purpose? Why not just use the actual command id?
Yes. If it's the same phrase use the same id otherwise generate new one. Using this we can group commands in the phrase. |
Just a uuid I guess? I thought you said we didn't have access to command id. The purpose is just hygiene. If we do transformations on the files, it's nice for each command to have an id so we can be sure it's the same. Just a data science best practice
👍 |
I don't really see how a uuid that gets generated for each command helps with anything? Or do you mean that we should just have a static one like a version number? cursorless/packages/common/src/cursorlessCommandIds.ts Lines 1 to 2 in 6718e84
|
It's just good practice. These IDs are very useful when doing postprocessing. But we can see if others feel strongly we should leave them out cc/ @phillco @josharian |
Made a few changes
Things left
|
update from meet-up:
|
id added |
Removed analyzer; created #2161 to track re-adding. Feel free to open PR with that patch once this one is in; lmk if you want help creating the patch @AndreasArvidsson |
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.
Ok I finished those last two steps, and tried installing locally to make sure it works as expected. Looking good! Feel free to merge if you're happy with my changes
setting: ```json "cursorless.commandHistory": true ``` Monthly log file: `cursorlessCommandHistory_2023-12.jsonl` ``` {"date":"2023-12-10","cursorlessVersion":"0.28.0-40a6fee4","command":{"version":6,"action":{"name":"setSelection","target":{"type":"primitive","modifiers":[{"type":"containingScope","scopeType":{"type":"line"}}]}},"usePrePhraseSnapshot":true}} ``` Voice command: `"Cursorless analyze history"` opens a new untitled document: ``` [2023-12] Total commands: 24 Actions (7): setSelection: 18 clearAndSetSelection: 1 remove: 1 wrapWithPairedDelimiter: 1 getText: 1 replace: 1 copyToClipboard: 1 Modifiers (2): containingScope: 20 relativeScope: 2 Scope types (4): line: 18 surroundingPair: 2 comment: 1 document: 1 ``` ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>
setting:
Monthly log file:
cursorlessCommandHistory_2023-12.jsonl
Voice command:
"Cursorless analyze history"
opens a new untitled document:Checklist