diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1f9c147 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +*.vsix +vsc-extension-quickstart.md diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..7bc18a4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +// A launch configuration that launches the extension inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ] + } + ] +} \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..bd6e3a8 --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,5 @@ +.vscode/** +.vscode-test/** +.gitignore +vsc-extension-quickstart.md +examples/** diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..275d71f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial release diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8429731 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2016 Josef Sin + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9830360 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Kusto Language Support + +Support for the Azure Log Analytics (Kusto) language syntax in Visual Studio Code. + +## Highlighting + +Adds highlighting support for Azure Log Analytics (Kusto) (`.csl` and `.kusto`). This syntax is based on [TextmateBundleInstaller](https://github.com/madskristensen/TextmateBundleInstaller) - [Kusto syntax](https://github.com/madskristensen/TextmateBundleInstaller/blob/master/src/Bundles/kusto/Syntaxes/kusto.plist). + +![Azure Log Analytics (Kusto) language syntax](/images/screenshot1.png?raw=true) + +## Bugs + +If you happen to see bugs or have suggestions for improvements visit the [issue section](https://github.com/josin/kusto-syntax-highlighting/issues) of the [repository](https://github.com/josin/kusto-syntax-highlighting). diff --git a/examples/example1.kusto b/examples/example1.kusto new file mode 100644 index 0000000..9ef53ad --- /dev/null +++ b/examples/example1.kusto @@ -0,0 +1,5 @@ +StormEvents +| where isnotempty(EndLocation) +| summarize event_count=count() by EndLocation +| top 10 by event_count +| render columnchart diff --git a/examples/example2.csl b/examples/example2.csl new file mode 100644 index 0000000..c20cd2d --- /dev/null +++ b/examples/example2.csl @@ -0,0 +1,10 @@ +let Events = MyLogTable | where ... ; + +Events +| where Name == "Start" +| project Name, City, SessionId, StartTime=timestamp +| join (Events + | where Name="Stop" + | project StopTime=timestamp, SessionId) + on activityId +| project City, SessionId, StartTime, StopTime, Duration = StopTime - StartTime diff --git a/images/screenshot1.png b/images/screenshot1.png new file mode 100644 index 0000000..ef92ac5 Binary files /dev/null and b/images/screenshot1.png differ diff --git a/language-configuration.json b/language-configuration.json new file mode 100644 index 0000000..aa25710 --- /dev/null +++ b/language-configuration.json @@ -0,0 +1,30 @@ +{ + "comments": { + // symbol used for single line comment. Remove this entry if your language does not support line comments + "lineComment": "//", + // symbols used for start and end a block comment. Remove this entry if your language does not support block comments + "blockComment": [ "/*", "*/" ] + }, + // symbols used as brackets + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + // symbols that that can be used to surround a selection + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ] +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..0562125 --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "kusto-syntax-highlighting", + "displayName": "Azure Log Analytics (Kusto) Syntax Highlighting", + "description": "Support for the Azure Log Analytics (Kusto) language syntax in Visual Studio Code.", + "version": "0.0.1", + "publisher": "josin", + "homepage": "https://github.com/josin/kusto-syntax-highlighting", + "repository": { + "type": "git", + "url": "https://github.com/josin/kusto-syntax-highlighting" + }, + "bugs": { + "url": "https://github.com/josin/kusto-syntax-highlighting/issues" + }, + "engines": { + "vscode": "^1.21.0" + }, + "categories": [ + "Languages" + ], + "keywords": [ + "kusto", + "azure", + "language", + "highlight", + "syntax" + ], + "license": "Apache-2.0", + "contributes": { + "languages": [{ + "id": "kusto", + "aliases": ["Kusto", "kusto"], + "extensions": [".csl", ".kusto"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "kusto", + "scopeName": "source.kusto", + "path": "./syntaxes/kusto.tmLanguage" + }] + } +} diff --git a/syntaxes/kusto.tmLanguage b/syntaxes/kusto.tmLanguage new file mode 100644 index 0000000..e03d3e0 --- /dev/null +++ b/syntaxes/kusto.tmLanguage @@ -0,0 +1,65 @@ + + + + + scopeName + source.kusto + + fileTypes + + csl + kusto + + + name + kusto file + + patterns + + + match + \b(let|count|ingestion_time|and|or|max|min|iff|isempty|isnotempty|log|sum|extract|now|false|true|makeset|makelist|any|arg_max|arg_min|any|dcount|sumif|countif|avg|materialize|pack|database|strcat|translate|substring|tostring|toscalar|strlen|contains|in|startswith|endswith|split|typeof)\b + name + keyword.functions.kusto + + + match + \b(where|summarize|extend|mvexpand|project|sort|project|-away|join|union|limit|order|sort|top|print|datatable)\b + name + keyword.control.kusto + + + match + ".*?" + name + string.constant.double + + + match + '.*?' + name + string.constant.single + + + match + //.* + name + comment + + + match + \{.*?\} + name + string.variable + + + match + \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b + name + constant.numeric + + + uuid + FF0550E0-3A29-11E3-AA6E-0800200C9B77 + +