Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
josin committed Mar 20, 2018
0 parents commit b7d1d89
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
node_modules
*.vsix
vsc-extension-quickstart.md
18 changes: 18 additions & 0 deletions .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}"
]
}
]
}
5 changes: 5 additions & 0 deletions .vscodeignore
@@ -0,0 +1,5 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
examples/**
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,3 @@
## 1.0.0

- Initial release
13 changes: 13 additions & 0 deletions 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.
13 changes: 13 additions & 0 deletions 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).
5 changes: 5 additions & 0 deletions examples/example1.kusto
@@ -0,0 +1,5 @@
StormEvents
| where isnotempty(EndLocation)
| summarize event_count=count() by EndLocation
| top 10 by event_count
| render columnchart
10 changes: 10 additions & 0 deletions 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
Binary file added images/screenshot1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions 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": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
42 changes: 42 additions & 0 deletions 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"
}]
}
}
65 changes: 65 additions & 0 deletions syntaxes/kusto.tmLanguage
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>scopeName</key>
<string>source.kusto</string>

<key>fileTypes</key>
<array>
<string>csl</string>
<string>kusto</string>
</array>

<key>name</key>
<string>kusto file</string>

<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\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</string>
<key>name</key>
<string>keyword.functions.kusto</string>
</dict>
<dict>
<key>match</key>
<string>\b(where|summarize|extend|mvexpand|project|sort|project|-away|join|union|limit|order|sort|top|print|datatable)\b</string>
<key>name</key>
<string>keyword.control.kusto</string>
</dict>
<dict>
<key>match</key>
<string>".*?"</string>
<key>name</key>
<string>string.constant.double</string>
</dict>
<dict>
<key>match</key>
<string>'.*?'</string>
<key>name</key>
<string>string.constant.single</string>
</dict>
<dict>
<key>match</key>
<string>//.*</string>
<key>name</key>
<string>comment</string>
</dict>
<dict>
<key>match</key>
<string>\{.*?\}</string>
<key>name</key>
<string>string.variable</string>
</dict>
<dict>
<key>match</key>
<string>\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</string>
<key>name</key>
<string>constant.numeric</string>
</dict>
</array>
<key>uuid</key>
<string>FF0550E0-3A29-11E3-AA6E-0800200C9B77</string>
</dict>
</plist>

0 comments on commit b7d1d89

Please sign in to comment.