Skip to content

Commit

Permalink
- Moving cheatsheet spoken form type definition to common package
Browse files Browse the repository at this point in the history
- Cleaning up some of my notes
- Using real default spoken form info for debugging purposes instead of dummy data that doesn't help debugging the usage stats in cheat sheet feature
  • Loading branch information
bra1nDump committed Dec 12, 2023
1 parent 32e1f65 commit b0262ef
Show file tree
Hide file tree
Showing 18 changed files with 1,757 additions and 1,709 deletions.
4 changes: 1 addition & 3 deletions cursorless-talon/src/cheatsheet/cheat_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ def private_cursorless_cheat_sheet_show_html():
cheatsheet_out_dir.mkdir(parents=True, exist_ok=True)
cheatsheet_out_path = cheatsheet_out_dir / cheatsheet_filename

# This will update the cheatsheet.html file
# Despite the showCheatsheet name, will only update the cheatsheet.html file,
actions.user.private_cursorless_run_rpc_command_and_wait(
"cursorless.showCheatsheet",
{
"version": 0,
# Add usage statistics as part of the spokenFormInfo option #3 (don't like this one)
"spokenFormInfo": cursorless_cheat_sheet_get_json(),
# Add usage statistics to the cheatsheet option #1
"outputPath": str(cheatsheet_out_path),
},
)
Expand Down
1 change: 0 additions & 1 deletion cursorless-talon/src/cheatsheet/get_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def get_raw_list(name: str) -> Mapping[str, str]:
return registry.lists[cursorless_list_name][0].copy()


# Is this code used when generating .html cheatsheet?
def make_dict_readable(
type: str, dict: Mapping[str, str], descriptions: Mapping[str, str]
) -> list[ListItemDescriptor]:
Expand Down
3 changes: 2 additions & 1 deletion packages/cheatsheet-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"dependencies": {
"@cursorless/cheatsheet": "workspace:*",
"@cursorless/common": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down Expand Up @@ -59,4 +60,4 @@
}
},
"type": "module"
}
}
3 changes: 2 additions & 1 deletion packages/cheatsheet-local/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CheatsheetPage, CheatsheetInfo } from "@cursorless/cheatsheet";
import { CheatsheetInfo } from "@cursorless/common";
import { CheatsheetPage } from "@cursorless/cheatsheet";
import "../styles.css";

declare global {
Expand Down
4 changes: 2 additions & 2 deletions packages/cheatsheet-local/src/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import {
cheatsheetBodyClasses,
fakeCheatsheetInfo,
defaultCheatsheetInfo,
} from "@cursorless/cheatsheet";
import HtmlWebpackInlineSourcePlugin from "@effortlessmotion/html-webpack-inline-source-plugin";
import HtmlWebpackPlugin from "html-webpack-plugin";
Expand All @@ -23,7 +23,7 @@ const config: Configuration = {
template: "src/index.html",
templateParameters: {
bodyClasses: cheatsheetBodyClasses,
fakeCheatsheetInfo: JSON.stringify(fakeCheatsheetInfo),
fakeCheatsheetInfo: JSON.stringify(defaultCheatsheetInfo),
},
inlineSource: ".(js|css)$", // embed all javascript and css inline
}),
Expand Down
11 changes: 9 additions & 2 deletions packages/cheatsheet-local/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"rootDir": "src",
"outDir": "out",
"jsx": "react-jsx",
"lib": ["es5", "es6", "dom"],
"lib": [
"es5",
"es6",
"dom"
],
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -17,6 +21,9 @@
"references": [
{
"path": "../cheatsheet"
},
{
"path": "../common"
}
],
"include": [
Expand All @@ -25,4 +32,4 @@
"src/**/*.tsx",
"../../typings/**/*.d.ts"
]
}
}
3 changes: 2 additions & 1 deletion packages/cheatsheet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"*.css"
],
"dependencies": {
"@cursorless/common": "workspace:*",
"@fortawesome/fontawesome-svg-core": "6.3.0",
"@fortawesome/free-solid-svg-icons": "6.3.0",
"@fortawesome/react-fontawesome": "0.2.0",
Expand All @@ -47,4 +48,4 @@
"typescript": "^5.2.2"
},
"type": "module"
}
}
1 change: 0 additions & 1 deletion packages/cheatsheet/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from "./lib/cheatsheet";
export * from "./lib/CheatsheetInfo";
export * from "./lib/cheatsheetBodyClasses";
export * from "./lib/fakeCheatsheetInfo";
import defaultCheatsheetInfo from "./lib/sampleSpokenFormInfos/defaults.json";
Expand Down
2 changes: 1 addition & 1 deletion packages/cheatsheet/src/lib/cheatsheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCircleQuestion } from "@fortawesome/free-solid-svg-icons/faCircleQuestion";
import CheatsheetNotesComponent from "./components/CheatsheetNotesComponent";
import SmartLink from "./components/SmartLink";
import { CheatsheetInfo } from "./CheatsheetInfo";
import { CheatsheetInfo } from "@cursorless/common";

type CheatsheetPageProps = {
cheatsheetInfo: CheatsheetInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CheatsheetSection, Variation } from "../CheatsheetInfo";
import { CheatsheetSection, Variation } from "@cursorless/common";
import useIsHighlighted from "../hooks/useIsHighlighted";
import { formatCaptures } from "./formatCaptures";

Expand Down
Loading

0 comments on commit b0262ef

Please sign in to comment.