diff --git a/README.md b/README.md
index c6618421..222e9072 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
diff --git a/src/renderer/components/editor/README.md b/src/renderer/components/editor/README.md
index acf2f193..1f2aefb3 100644
--- a/src/renderer/components/editor/README.md
+++ b/src/renderer/components/editor/README.md
@@ -17,6 +17,7 @@ This is a list of language that supports in massCode.
- AutoHotkey / AutoIt
- Bash
- BatchFile
+- Bicep
- C and C++
- C#
- Cirru
@@ -73,6 +74,7 @@ This is a list of language that supports in massCode.
- JSX
- Julia
- Kotlin
+- Kusto (KQL)
- LaTeX
- Latte
- LESS
diff --git a/src/renderer/components/editor/grammars/bicep.tmLanguage.json b/src/renderer/components/editor/grammars/bicep.tmLanguage.json
new file mode 100644
index 00000000..aedc4187
--- /dev/null
+++ b/src/renderer/components/editor/grammars/bicep.tmLanguage.json
@@ -0,0 +1,143 @@
+{
+ "scopeName": "source.bicep",
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "patterns": [{ "include": "#expression" }, { "include": "#comments" }],
+ "repository": {
+ "line-comment": {
+ "name": "comment.line.double-slash.bicep",
+ "match": "//.*(?=$)"
+ },
+ "keyword": {
+ "name": "keyword.control.declaration.bicep",
+ "match": "\\b(metadata|targetScope|resource|module|param|var|output|for|in|if|existing|import|as|type|with)\\b"
+ },
+ "object-literal": {
+ "begin": "{",
+ "end": "}",
+ "patterns": [
+ { "include": "#object-property-key" },
+ { "include": "#expression" },
+ { "include": "#comments" }
+ ],
+ "name": "meta.object-literal.bicep"
+ },
+ "string-literal-subst": {
+ "begin": "(?)",
+ "end": "(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*=>",
+ "name": "meta.lambda-start.bicep",
+ "beginCaptures": {
+ "1": {
+ "name": "meta.undefined.bicep",
+ "patterns": [{ "include": "#identifier" }, { "include": "#comments" }]
+ }
+ }
+ },
+ "function-call": {
+ "begin": "(\\b[_$[:alpha:]][_$[:alnum:]]*\\b)(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\(",
+ "end": "\\)",
+ "patterns": [{ "include": "#expression" }, { "include": "#comments" }],
+ "name": "meta.function-call.bicep",
+ "beginCaptures": { "1": { "name": "entity.name.function.bicep" } }
+ },
+ "escape-character": {
+ "name": "constant.character.escape.bicep",
+ "match": "\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|'|\\${)"
+ },
+ "identifier": {
+ "name": "variable.other.readwrite.bicep",
+ "match": "\\b[_$[:alpha:]][_$[:alnum:]]*\\b(?!(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*\\()"
+ },
+ "string-literal": {
+ "begin": "'(?!'')",
+ "end": "'",
+ "patterns": [
+ { "include": "#escape-character" },
+ { "include": "#string-literal-subst" }
+ ],
+ "name": "string.quoted.single.bicep"
+ },
+ "directive-variable": {
+ "name": "keyword.control.declaration.bicep",
+ "match": "\\b[_a-zA-Z-0-9]+\\b"
+ },
+ "directive": {
+ "begin": "#\\b[_a-zA-Z-0-9]+\\b",
+ "end": "$",
+ "patterns": [
+ { "include": "#directive-variable" },
+ { "include": "#comments" }
+ ],
+ "name": "meta.directive.bicep"
+ },
+ "decorator": {
+ "begin": "@(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*(?=\\b[_$[:alpha:]][_$[:alnum:]]*\\b)",
+ "end": "",
+ "patterns": [{ "include": "#expression" }, { "include": "#comments" }],
+ "name": "meta.decorator.bicep"
+ },
+ "block-comment": {
+ "name": "comment.block.bicep",
+ "begin": "/\\*",
+ "end": "\\*/"
+ },
+ "comments": {
+ "patterns": [
+ { "include": "#line-comment" },
+ { "include": "#block-comment" }
+ ]
+ },
+ "numeric-literal": { "name": "constant.numeric.bicep", "match": "[0-9]+" },
+ "expression": {
+ "patterns": [
+ { "include": "#string-literal" },
+ { "include": "#string-verbatim" },
+ { "include": "#numeric-literal" },
+ { "include": "#named-literal" },
+ { "include": "#object-literal" },
+ { "include": "#array-literal" },
+ { "include": "#keyword" },
+ { "include": "#identifier" },
+ { "include": "#function-call" },
+ { "include": "#decorator" },
+ { "include": "#lambda-start" },
+ { "include": "#directive" }
+ ]
+ },
+ "named-literal": {
+ "name": "constant.language.bicep",
+ "match": "\\b(true|false|null)\\b"
+ }
+ },
+ "name": "Bicep",
+ "fileTypes": [".bicep"]
+}
diff --git a/src/renderer/components/editor/grammars/kusto.tmLanguage.json b/src/renderer/components/editor/grammars/kusto.tmLanguage.json
new file mode 100644
index 00000000..b46bd073
--- /dev/null
+++ b/src/renderer/components/editor/grammars/kusto.tmLanguage.json
@@ -0,0 +1,684 @@
+{
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "scopeName": "source.kusto",
+ "fileTypes": ["csl", "kusto", "kql"],
+ "name": "Kusto",
+ "patterns": [
+ {
+ "match": "\\b(by|from|of|to|step|with)\\b",
+ "name": "keyword.other.operator.kusto",
+ "comment": "Tabular operators: common helper operators"
+ },
+ {
+ "match": "\\b(let|set|alias|declare|pattern|query_parameters|restrict|access|set)\\b",
+ "name": "keyword.control.kusto",
+ "comment": "Query statements: https://docs.microsoft.com/en-us/azure/kusto/query/statements"
+ },
+ {
+ "match": "\\b(and|or|has_all|has_any|matches|regex)\\b",
+ "name": "keyword.other.operator.kusto",
+ "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatypes-string-operators"
+ },
+ {
+ "match": "\\b(cluster|database)(?:\\s*\\(\\s*(.+?)\\s*\\))?(?!\\w)",
+ "captures": {
+ "1": {
+ "name": "support.function.kusto"
+ },
+ "2": {
+ "patterns": [
+ {
+ "include": "#Strings"
+ }
+ ]
+ }
+ },
+ "name": "meta.special.database.kusto",
+ "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/clusterfunction"
+ },
+ {
+ "match": "\\b(external_table|materialized_view|materialize|table|toscalar)\\b",
+ "name": "support.function.kusto",
+ "comment": "Special functions: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/tablefunction"
+ },
+ {
+ "match": "(? import('./grammars/batchfile.tmLanguage.json'),
scopeName: 'source.batchfile'
},
+ {
+ name: 'Bicep',
+ value: 'bicep',
+ grammar: () => import('./grammars/bicep.tmLanguage.json'),
+ scopeName: 'source.bicep'
+ },
{
name: 'C and C++',
value: 'c_cpp',
@@ -430,6 +436,12 @@ export const languages: LanguageOption[] = [
grammar: () => import('./grammars/kotlin.tmLanguage.json'),
scopeName: 'source.kotlin'
},
+ {
+ name: 'Kusto (KQL)',
+ value: 'kusto',
+ grammar: () => import('./grammars/kusto.tmLanguage.json'),
+ scopeName: 'source.kusto'
+ },
{
name: 'LaTeX',
value: 'latex',
diff --git a/src/renderer/components/preferences/EditorPreferences.vue b/src/renderer/components/preferences/EditorPreferences.vue
index 0aa26e4f..1519db1f 100644
--- a/src/renderer/components/preferences/EditorPreferences.vue
+++ b/src/renderer/components/preferences/EditorPreferences.vue
@@ -84,8 +84,8 @@ const trailingCommaOptions = [
value: 'all'
},
{
- label: i18n.t('preferences:editor.prettier.trailingComma.es6'),
- value: 'es6'
+ label: i18n.t('preferences:editor.prettier.trailingComma.es5'),
+ value: 'es5'
}
]
diff --git a/src/renderer/components/screenshot/TheScreenshot.vue b/src/renderer/components/screenshot/TheScreenshot.vue
index 493415a5..e89c9275 100644
--- a/src/renderer/components/screenshot/TheScreenshot.vue
+++ b/src/renderer/components/screenshot/TheScreenshot.vue
@@ -131,7 +131,8 @@ const props = defineProps
()
const appStore = useAppStore()
const snippetStore = useSnippetStore()
-const { escape } = useMagicKeys()
+// eslint-disable-next-line camelcase
+const { escape, Meta_C, Ctrl_C } = useMagicKeys()
const frameRef = ref()
const snippetRef = ref()
@@ -200,6 +201,7 @@ const init = () => {
? getThemeName('dark:material')
: getThemeName('light:github'),
lineNumbers: false,
+ lineWrapping: true,
tabSize: appStore.editor.tabSize,
scrollbarStyle: 'null',
readOnly: true
@@ -249,6 +251,12 @@ const onSaveScreenshot = async (type: 'png' | 'svg' = 'png') => {
track('snippets/create-screenshot')
}
+const copyToClipboard = async () => {
+ const data = await domToImage.toBlob(snippetRef.value!)
+ navigator.clipboard.write([new ClipboardItem({ 'image/png': data })])
+ track('snippets/create-screenshot')
+}
+
watch(
() => appStore.screenshot.darkMode,
v => {
@@ -268,10 +276,6 @@ watch(
{ deep: true }
)
-watch(escape, () => {
- snippetStore.isScreenshotPreview = false
-})
-
watch(
() => props.snippet,
v => setValue(v)
@@ -281,6 +285,21 @@ watch(
v => setLang(v)
)
+watch(escape, () => {
+ snippetStore.isScreenshotPreview = false
+})
+
+watch(Meta_C, v => {
+ if (v) {
+ copyToClipboard()
+ }
+})
+watch(Ctrl_C, v => {
+ if (v) {
+ copyToClipboard()
+ }
+})
+
onMounted(() => {
init()
})
diff --git a/src/renderer/store/folders.ts b/src/renderer/store/folders.ts
index 0605dbee..e5db4a16 100644
--- a/src/renderer/store/folders.ts
+++ b/src/renderer/store/folders.ts
@@ -1,5 +1,5 @@
import { useApi } from '@/composable'
-import { store } from '@/electron'
+import { i18n, store } from '@/electron'
import { flatToNested } from '@/utils'
import type { Folder, FolderTree } from '@shared/types/main/db'
import { defineStore } from 'pinia'
@@ -34,7 +34,7 @@ export const useFolderStore = defineStore('folders', {
const snippetStore = useSnippetStore()
const body: Partial = {
- name: 'Untitled folder',
+ name: i18n.t('folder.untitled'),
parentId: null,
isOpen: false,
isSystem: false,
diff --git a/src/shared/types/renderer/editor/index.d.ts b/src/shared/types/renderer/editor/index.d.ts
index 2902c2fa..1df4de50 100644
--- a/src/shared/types/renderer/editor/index.d.ts
+++ b/src/shared/types/renderer/editor/index.d.ts
@@ -14,6 +14,7 @@ export type Language =
| 'assembly_x86'
| 'autohotkey'
| 'batchfile'
+ | 'bicep'
| 'c_cpp'
| 'c9search'
| 'cirru'
@@ -78,6 +79,7 @@ export type Language =
| 'jsx'
| 'julia'
| 'kotlin'
+ | 'kusto'
| 'latex'
| 'latte'
| 'less'