Skip to content

Commit

Permalink
Complete current statement with semicolon if JS and configured
Browse files Browse the repository at this point in the history
Fixes kasecato#65 by inserting a semicolon at the end of the line if language is JavaScript (or TypeScript) and semicolons are configured as required using the existing `javascript.format.semicolons` configuration option in the JavaScript extension.
  • Loading branch information
grgar committed Apr 28, 2024
1 parent 7a9a83c commit 076cdd9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ctrl+space | ctrl+space | Basic code completion (the name of any class, method o
ctrl+shift+space | ctrl+shift+space | Smart code completion (filters the list of methods and variables by expected type) | N/A
enter | enter | Choose Lookup Item | ✅
tab | tab | Choose Lookup Item Replace | ✅
ctrl+shift+enter | cmd+shift+enter | Complete statement | ✅
ctrl+shift+enter | cmd+shift+enter | Complete Current Statement | ✅
ctrl+p | cmd+p | Parameter info (within method call arguments) | ✅
ctrl+q | ctrl+j | Quick documentation lookup | ✅
N/A | f1 | Quick documentation lookup | ✅
Expand Down
26 changes: 25 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,31 @@
"mac": "cmd+shift+enter",
"command": "acceptSelectedSuggestion",
"when": "suggestWidgetVisible && textInputFocus",
"intellij": "Complete statement"
"intellij": "Complete Current Statement"
},
{
"key": "ctrl+shift+enter",
"mac": "cmd+shift+enter",
"command": "runCommands",
"args": {
"commands": [
"acceptSelectedSuggestion",
{
"command": "cursorMove",
"args": {
"to": "wrappedLineEnd"
}
},
{
"command": "editor.action.insertSnippet",
"args": {
"snippet": ";"
}
}
]
},
"when": "suggestWidgetVisible && textInputFocus && (resourceLangId == 'javascript' || resourceLangId == 'typescript') && config.javascript.format.semicolons == 'insert'",
"intellij": "Complete Current Statement"
},
{
"key": "ctrl+p",
Expand Down
26 changes: 25 additions & 1 deletion src/package-with-comment.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,31 @@
"mac": "cmd+shift+enter",
"command": "acceptSelectedSuggestion",
"when": "suggestWidgetVisible && textInputFocus",
"intellij": "Complete statement"
"intellij": "Complete Current Statement"
},
{
"key": "ctrl+shift+enter",
"mac": "cmd+shift+enter",
"command": "runCommands",
"args": {
"commands": [
"acceptSelectedSuggestion",
{
"command": "cursorMove",
"args": {
"to": "wrappedLineEnd"
}
},
{
"command": "editor.action.insertSnippet",
"args": {
"snippet": ";"
}
}
]
},
"when": "suggestWidgetVisible && textInputFocus && (resourceLangId == 'javascript' || resourceLangId == 'typescript') && config.javascript.format.semicolons == 'insert'",
"intellij": "Complete Current Statement"
},
{
"key": "ctrl+p",
Expand Down

0 comments on commit 076cdd9

Please sign in to comment.