Skip to content

Commit

Permalink
feat: implement comment shortcut
Browse files Browse the repository at this point in the history
Signed-off-by: seven <[email protected]>
  • Loading branch information
Blankll committed Jan 11, 2025
1 parent 42cfc81 commit 398332a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/common/monaco/lexerRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,9 @@ export const search = {
{ open: `'`, close: `'` },
{ open: '"', close: '"' },
],
comments: {
lineComment: '//',
blockComment: ['/*', '*/'],
},
},
};
2 changes: 1 addition & 1 deletion src/components/VersionDetect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getLatestReleaseInfo = async (): Promise<{
return { version: data.tag_name, assets };
};
const getLatestLink = async () => {
return 'https://github.com/geek-fun/dockit/releases';
return 'https://dockit.geekfun.club/download.html';
};
onMounted(async () => {
Expand Down
7 changes: 6 additions & 1 deletion src/views/editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ const setupQueryEditor = (code: string) => {
}
});
// comments/uncomment line or block
queryEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Slash, () => {
queryEditor!.trigger('keyboard', 'editor.action.commentLine', {});
});
// Auto indent current request
queryEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyI, () => {
const { position } = getAction(queryEditor!.getPosition()) || {};
Expand Down Expand Up @@ -331,7 +336,7 @@ const setupQueryEditor = (code: string) => {
});
// Open the documentation for the current action
queryEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Slash, () => {
queryEditor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyD, () => {
const docLink = getActionApiDoc(
EngineType.ELASTICSEARCH,
'current',
Expand Down

0 comments on commit 398332a

Please sign in to comment.