Skip to content

Commit

Permalink
feat: add formatter and a simple formatting function as a PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
rszyma committed Jan 8, 2024
1 parent f0a1045 commit 7a57a7f
Show file tree
Hide file tree
Showing 17 changed files with 933 additions and 270 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ jobs:
env:
VSCE_PAT: ${{ secrets.VSCE_ACCESS_TOKEN }}
run: |
make package
make CARGO_FLAGS=--release package
just release ${{ steps.new_version.outputs.value }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/target
**/node_modules
**/out
out
yarn-error.log
.vscode-test
*.vsix
Expand Down
25 changes: 24 additions & 1 deletion client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class Extension implements Disposable {
.getConfiguration()
.get<string>('vscode-kanata.includesAndWorkspaces', ''),
localKeysVariant: localKeysVariant as string,
format: getFormatterSettings(),
},
};

Expand Down Expand Up @@ -258,4 +259,26 @@ function getLocalKeysVariant(): LocalKeysVariant {
}

return localKeysVariant as LocalKeysVariant;
}
}


interface FormatterSettings {
enable: boolean;
}

// Gets localkeys variant from config and when set to auto, detects it based on current OS.
function getFormatterSettings(): FormatterSettings {
const formatSettings = workspace
.getConfiguration()
.get<FormatterSettings>('vscode-kanata.format');

if (formatSettings === undefined) {
throw new Error('should be defined')
}

console.log("formatSettings:", formatSettings)

return formatSettings;
}


7 changes: 6 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ _default:
install:
git submodule update
make package
code --install-extension kanata.vsix
code --install-extension kanata.vsix --force

install_release:
git submodule update
make CARGO_FLAGS=--release package
code --install-extension kanata.vsix --force

# Creates a commit, that updates kanata to latest git and adds notice about it to CHANGELOG.md
bump_kanata:
Expand Down
1 change: 1 addition & 0 deletions kls/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
5 changes: 5 additions & 0 deletions kls/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"rust-lang.rust-analyzer"
]
}
5 changes: 5 additions & 0 deletions kls/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// "rust-analyzer.cargo.target": "wasm32-unknown-unknown",
"rust-analyzer.cargo.features": "all",
"rust-analyzer.showUnlinkedFileNotification": false,
}
Loading

0 comments on commit 7a57a7f

Please sign in to comment.