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 8f4e843
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 66 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
152 changes: 88 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@
}
],
"keybindings": [



{
"key": "enter",
"mac": "enter",
Expand All @@ -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 All @@ -136,8 +160,8 @@
"when": "editorTextFocus",
"intellij": "Quick documentation lookup"
},


{
"key": "ctrl+f1",
"mac": "cmd+f1",
Expand Down Expand Up @@ -179,7 +203,7 @@
"when": "editorLangId == java && javaLSReady && editorTextFocus",
"intellij": "Implement methods"
},

{
"command": "intellij.openInOppositeGroup",
"when": "editorTextFocus",
Expand Down Expand Up @@ -239,7 +263,7 @@
"when": "notebookEditorFocused && !inputFocus",
"notebook": "To keep Notebook key bindings"
},

{
"key": "alt+enter",
"mac": "alt+enter",
Expand Down Expand Up @@ -296,9 +320,9 @@
"when": "editorTextFocus && !editorReadonly && supportedCodeAction =~ /(\\s|^)source\\.organizeImports\\b/",
"intellij": "Optimize imports"
},



{
"key": "ctrl+x",
"mac": "cmd+x",
Expand All @@ -313,9 +337,9 @@
"when": "editorTextFocus && !editorReadonly",
"intellij": "Cut current line or selected block to clipboard"
},



{
"key": "ctrl+d",
"mac": "cmd+d",
Expand Down Expand Up @@ -372,9 +396,9 @@
"when": "notebookCellListFocused && notebookCellType == 'markup' || notebookCellListFocused && notebookMissingKernelExtension && !notebookCellExecuting && notebookCellType == 'code' || notebookCellListFocused && !notebookCellExecuting && notebookCellType == 'code' && notebookKernelCount > 0 || notebookCellListFocused && !notebookCellExecuting && notebookCellType == 'code' && notebookKernelSourceCount > 0",
"notebook": "To keep Notebook key bindings"
},



{
"key": "ctrl+right",
"mac": "alt+right",
Expand Down Expand Up @@ -611,14 +635,14 @@
"when": "editorTextFocus",
"intellij": "Decrease Font Size in All Editors"
},

{
"key": "shift shift",
"mac": "shift shift",
"command": "workbench.action.quickOpen",
"intellij": "Search everywhere"
},

{
"key": "f3",
"mac": "cmd+g",
Expand Down Expand Up @@ -660,9 +684,9 @@
"command": "workbench.action.replaceInFiles",
"intellij": "Replace in path"
},



{
"key": "alt+f7",
"mac": "alt+f7",
Expand All @@ -677,17 +701,17 @@
"when": "editorHasReferenceProvider && editorTextFocus && !inReferenceSearchEditor",
"intellij": "Show usages"
},




{
"key": "ctrl+f9",
"mac": "cmd+f9",
"command": "workbench.action.tasks.build",
"intellij": "Make project (compile modifed and dependent)"
},

{
"key": "alt+shift+f10",
"mac": "ctrl+alt+r",
Expand Down Expand Up @@ -715,9 +739,9 @@
"when": "debuggersAvailable && !inDebugMode && !terminalFocus",
"intellij": "Debug"
},



{
"key": "ctrl+f2",
"mac": "cmd+f2",
Expand All @@ -739,7 +763,7 @@
"when": "debugState != 'inactive'",
"intellij": "Step into"
},

{
"key": "shift+f8",
"mac": "shift+f8",
Expand Down Expand Up @@ -788,7 +812,7 @@
"command": "workbench.debug.action.focusBreakpointsView",
"intellij": "View breakpoints"
},

{
"key": "ctrl+n",
"mac": "cmd+o",
Expand Down Expand Up @@ -832,16 +856,16 @@
"command": "workbench.action.nextEditor",
"intellij": "Go to next editor tab"
},


{
"key": "shift+escape",
"mac": "shift+escape",
"command": "workbench.action.toggleSidebarVisibility",
"when": "!editorFocus && !terminalFocus && !problemFocus && !inDebugRepl",
"intellij": "Hide active or last active window (Sidebar)"
},

{
"key": "shift+escape",
"mac": "shift+escape",
Expand All @@ -861,8 +885,8 @@
"command": "workbench.action.terminal.toggleTerminal",
"intellij": "Hide active or last active window (Terminal)"
},


{
"key": "ctrl+shift+'",
"mac": "cmd+shift+'",
Expand Down Expand Up @@ -944,7 +968,7 @@
"command": "workbench.action.navigateToLastEditLocation",
"intellij": "Navigate to last edit location"
},

{
"key": "ctrl+b",
"mac": "cmd+b",
Expand Down Expand Up @@ -1000,10 +1024,10 @@
"when": "editorTextFocus && editorLangId == 'dart'",
"intellij": "Go to super-method/super-class"
},




{
"key": "alt+7",
"mac": "cmd+7",
Expand All @@ -1024,7 +1048,7 @@
"when": "editorLangId == java && javaLSReady && editorTextFocus",
"intellij": "Type hierarchy"
},

{
"key": "ctrl+alt+h",
"mac": "ctrl+alt+h",
Expand Down Expand Up @@ -1079,11 +1103,11 @@
"when": "editorTextFocus && !editorReadonly",
"intellij": "Move Statement Up"
},





{
"key": "ctrl+alt+shift+down",
"mac": "ctrl+alt+shift+down",
Expand Down Expand Up @@ -1140,8 +1164,8 @@
"when": "editorTextFocus && java:testRunnerActivated",
"intellij": "Go to Test"
},


{
"key": "ctrl+alt+shift+t",
"mac": "ctrl+t",
Expand All @@ -1159,7 +1183,7 @@
},
"intellij": "Move"
},

{
"key": "shift+f6",
"mac": "shift+f6",
Expand Down Expand Up @@ -1192,7 +1216,7 @@
},
"intellij": "Change Signature"
},

{
"key": "ctrl+alt+m",
"mac": "cmd+alt+m",
Expand Down Expand Up @@ -1248,7 +1272,7 @@
},
"intellij": "Introduce Parameter"
},

{
"key": "ctrl+alt+k",
"mac": "cmd+k",
Expand Down Expand Up @@ -1276,11 +1300,11 @@
"when": "editorTextFocus && !editorReadonly",
"intellij": "Rollback Lines"
},





{
"key": "alt+0",
"mac": "cmd+0",
Expand Down Expand Up @@ -1411,15 +1435,15 @@
"command": "workbench.action.files.saveAll",
"intellij": "Save all"
},

{
"mac": "ctrl+cmd+f",
"command": "workbench.action.toggleFullScreen",
"intellij": "Toggle full screen mode"
},



{
"key": "ctrl+`",
"mac": "ctrl+`",
Expand Down Expand Up @@ -1463,7 +1487,7 @@
"command": "workbench.action.resetViewLocations",
"intellij": "Restore Default layout"
},

{
"key": "ctrl+d",
"mac": "cmd+d",
Expand Down Expand Up @@ -1625,7 +1649,7 @@
"intellij": "Copy paths",
"when": "!editorFocus && !terminalFocus"
},

{
"key": "shift+f10",
"mac": "ctrl+r",
Expand Down

0 comments on commit 8f4e843

Please sign in to comment.