Git Product home page Git Product logo

kuskus's Introduction

Kuskus

The extension pack so nice they named it twice

This repo houses a number of useful extensions supporting Kusto development in VS Code. They can be installed independently, but it's recommended to just install the extension pack which includes them all.

Kusto is an ergonomic database query language used extensively across Microsoft: https://aka.ms/kusto.

VS Code is a lightweight code editor https://code.visualstudio.com/

Contributing

This project is not under active development as of June 2020. Contributions are still welcome. I also would welcome a volunteer to take over the project. If you are interested, please open an issue to let me know!

Extensions

[Kuskus] Kusto Extension Pack All extensions in one pack. One click to install them all!
- -
Kusto Syntax Highlighting Textmate grammar. Works with most themes. Fork of josefsin/kusto-syntax-highlighting.
Kusto Color Themes [Kuskus] Kusto (Dark)
[Kuskus] Kusto (Dark)
Kusto Language Server Autocomplete
Autocomplete
Hover info
Hover Info
Format Document
Format Document
Supports builtins out of the box. You can also Load Symbols to get intellisense for the tables and functions on your cluster.
Load Symbols
Diagnostics are also available, but are not yet fully supported and are disabled by default. Diagnostics are the red squiggly underlines / the items in the Problems tab.

Future Extensions

Deploy with Kustodian Check your functions, tables, and policies into source. Deploy them with Kustodian.
Run this Query Open Kusto Web Explorer and run the selected query

Contributors

  • Ross Anderson, on github @rosshamish
  • Peter Weisbeck, on github @weisbeck
  • Bradley Holloway, on github @bradleyholloway
  • Josiah Matlack, on github @mosqutip
  • Pradeep Vairamani

Bugs

Please file bugs and suggestions in the issue tracker.

kuskus's People

Contributors

caleb-wishart avatar dependabot[bot] avatar gh-action-bump-version avatar golf1052 avatar o-l-a-v avatar roander-msft avatar rosshamish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kuskus's Issues

Control+T, Outlines do not present user defined functions or variables

If I create a .kql document and put in the following code:

let BytesInMB=(bytes: long) {
   round(bytes / 1024.0 / 1024.0, 2)
};
print a=BytesInMB(42)
;

I'd like to see two things:

  • Pressing Control-T presents an indexed view of all the symbols in the workspace. I should be able to search for 'Bytes' and navigate directly to BytesInMB, from any document I have open.
    • Currently, the Control-T simply shows No matching symbols in workspace
  • The outline view for a document, the pane displayed below the Kusto Workspace in the "Explorer" view, should show BytesInMB as a symbol, along with any other variables/functions/tables defined in the document.
    • Currently, the outline view simply says No symbols found in document 'temp.kql'

Allow connecting to cluster using settings and environment variables

Currently, when I want to connect to a cluster I need to load it which means manually entering the cluster URL, authority id and database. Then we go to the microsoft login page.

Instead it would be useful if I could define in the settings some database and allow to extract their credentials from environment variables.
For example in the settings I would have something like:

"databases": [{
"database_id": "db1"
"database": "my_database1"
"cluster": "https://my_cluster.kusto.windows.net",
"authority_id": "${authority_id_env_var_for_cluster1}",
"client_id": "${client_id_env_var_for_cluster1}",
"client_secret": "${client_secret_env_var_for_cluster1}",
},{...}]

Then I would be able to give a command: load db1 and the connection would be configured where it gets the credentials from environment variables.

TODO: Use upstream jq-action

jq-action was missing multiline support, so I added it downstream here to use. I then contributed it back upstream in sergeysova/jq-action#3.

This issue tracks removing the downstream use in .github\actions\jq-action-master in favor of upstream sergeysova/jq-action, which can only be done once that PR merges and a new version is released.

Comment out line

Not sure if it is a bug or new feature request, but the comment out shortcut (Ctrl+/) does not work for Kusto syntax (it does not add // at the beggining of the line).

I love the package btw.

Pre-format the document before passing it to KustoCodeService

The KustoCodeService chunks up a document in sometimes strange ways, which leads to odd document formatting. See JANK_CLEANUP.md for a couple examples of this.

The idea here would be to do a pre-formatting step where newlines are added or removed in certain places before passing the text on to the KustoCodeService, in a way so that the code service chunks it into blocks more logically.

For example,

  • when the document is a .create-or-alter statement
    • removing blank lines between the .create-or-alter command and the function name, or blank lines between the function name and the opening {.
    • adding a blank line between the opening { and the first query block
    • adding a blank line between the closing } and the preceding block
  • when the document has multiple blocks separated by semi-colons
    • adding a blank line after each semi-colon

Cache kusto auth tokens

Right now, there's a device code auth flow for every single kusto.execute() call. It would open up some use cases if we could make many kusto calls without each of them requiring a login (table schema fetching, detailed function metadata fetching).

This is probably a feature request to the azure-kusto-node library (or a contribution to it).

Load symbols from cluster crashing with properties.getClientTimeout is not a function

When trying to load symbols from a cluster I get the following error:

/home/pearj/.vscode-server/extensions/rosshamish.kuskus-kusto-language-server-1.0.35/server/node_modules/azure-kusto-data/dist-esm/src/client.js:226
            const clientTimeout = properties.getClientTimeout();
                                             ^

TypeError: properties.getClientTimeout is not a function
    at KustoClient._getClientTimeout (/home/pearj/.vscode-server/extensions/rosshamish.kuskus-kusto-language-server-1.0.35/server/node_modules/azure-kusto-data/dist-esm/src/client.js:226:46)
    at KustoClient._execute (/home/pearj/.vscode-server/extensions/rosshamish.kuskus-kusto-language-server-1.0.35/server/node_modules/azure-kusto-data/dist-esm/src/client.js:113:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.15.0
[Info  - 12:34:35 PM] Connection to server got closed. Server will restart.

Any idea what is causing this? I'm running vscode 1.84.2 inside WSL2

Add snippet support

The first snippet should be

.create-or-alter function with (folder="", docstring="", skipvalidation="false")
FunctionName(param1: int, param2: string)
{

    // query

}

Does not lint Jupyter notebooks

Setting a Jupyter notebook cell's language to Kusto (this extension) causes the cell to fail to lint. Please extend this extension's linting to Jupyter cells / embedded KQL contexts.

Tooltip error when using .create-or-alter: Cannot read properties of undefined (reading: 'IsOptional')

With the following code, hovering over any keyword results in a tooltip Cannot read properties of undefined (reading: 'IsOptional')

.create-or-alter function 
BytesInMB(bytes: long) {
   round(bytes / 1024.0 / 1024.0, 2)
}

It doesn't seem to matter what's in the function body. In fact, it seems to happen with any dot commands (e.g. .show table).

Changing the function above to use let BytesInMB=() syntax, the tooltips work correctly.

Run query from selection / from document

We don't want to dupe functionality from Kusto Explorer / Kusto Web Explorer though, so probably the best route here is to generate a link to kusto web explorer with the query text url encoded, then use open() to open it in the browser. Shell out to web explorer, which already implements all this. Folks can bounce back and forth between the web explorer (for execution) and vs code (for source control).

Best part of this would be that the web explorer and vs code's editor capabilities are based on the same npm module(s), so the editing experience should/would be exactly the same. Consistency!

Syntax Highlighting does not work

Hi,
Installed the Kuskus pack, but I don't get the syntax highlighting I expect and can't fin any information on what I should do to make it work.
/Per

Kuskus markdown syntax highlighting messes up markdown highlighting outside code block

Product Version
VSCode v1.86.2
[Kuskus] Kusto Syntax Highlighting v1.2.0

Kuskus markdown syntax highlighting messes up markdown highlighting even outside the code block.

Sample markdown code

# Test

## First query

```kql
SomeTable
| top 10 by TimeGenerated desc
```

## Second query

```kql
SomeTable
| top 10 by TimeGenerated desc
```

## Third query

```kql
SomeTable
| top 10 by TimeGenerated desc
```

Result in VSCode

image

Seems it alternates too. So all text under an odd number of kql / kusto code blocks does not get proper regular markdown highlighting.

If you change codeblock to something else like sql instead, highlighted markdown outside a codeblock is not affected:

image

authentication trouble

i always have trouble authenticating with data explorer (web ui works, but kusto explorer does not), so it's def not specific to kuskus but is there any other way to authenticate? or maybe to choose a specific tenant id?

also i know nothing about vscode extensions or typescript but just wanted to say thanks for this! was disappointed there's no kusto extension in VS so this is nice. i'd like to learn enough to make an extension for kusto similar to mssql in VSCode or npgsql in VS, but who know...

TODO: Use upstream gh-action-bump-version

gh-action-bump-version was missing "skip-push" capability, so I added it downstream here to use. I then contributed it back upstream in phips28/gh-action-bump-version#143.

This issue tracks removing the downstream use in .github\actions\gh-action-bump-version-master in favor of upstream phips28/gh-action-bump-version, which can only be done once a new version is released.

Function completion without needing the database() prefix

Right now, for some reason, to get functions to show up in the completion list, the user must first type database('DatabaseName').. Most functions are not called this way, and it's not intuitive that this is required. It would be great if the completion list could include functions in the default database without requiring the prefix.

Use npm-published versions of @kusto/language-service dependencies

We directly include some versions of these dependencies in this repo. This is kinda janky but got us off the ground.

The packages are

  • @kusto/language-service
  • @kusto/language-service-next

We should probably just use @kusto/language-service, once all the changes that we depend on are incorporated. The files we'll be able to drop (and instead reference the versions in node_modules) are:

  • Kusto.Language.Bridge.min.js
  • bridge.min.js
  • typings/MissingFromBridge.d.ts
  • typings/refs.d.ts

[Feature Request] Markdown Syntax Highlighting Support

[Feature Request] Markdown Syntax Highlighting Support

Reproduction

For those that don't know, when you create a codeblock in a VSCode markdown document, you can put many well-known languages on the same line, and it will provide syntax highlighting. Copy/paste the following in a VSCode markdown documen to see what I mean.

```Python
# Python comment
print("Hellow World")
```

"Python" and "py" provide syntax.

"Golang" and "Go" uses different comment blocks, just to illustrate that it is language specific

```Golang
package main
import ("fmt")

func main() {
  // This is a comment
  fmt.Println("Hello World!")
}
```

However, with KQL/Kusto, it has no syntax highlighting, and defaults to the standard codeblock.

```Kusto
// This is a kusto comment 
someTableName
| search "HelloWorld"
```

Request

I'm not sure if it's possible to add this feature via kuskus, or if it would have to be added to the default Markdown package (or somewhere else).

If it can't be added, but you have any other information about where or how a user might manually wedge in their own markdown language support, I would appreciate anything you have to offer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.