GithubHelp home page GithubHelp logo

azure / monaco-kusto Goto Github PK

View Code? Open in Web Editor NEW
75.0 25.0 28.0 123.64 MB

Kusto query language support for the Monaco editor

License: MIT License

JavaScript 13.60% TypeScript 84.22% HTML 2.03% CSS 0.15%

monaco-kusto's Introduction

Monaco Kusto

Kusto language plugin for the Monaco Editor. It provides the following features when editing CSL, KQL files:

  • Code completion
  • Syntax highlighting
  • Validation: Syntax errors and linting
  • code folding / outlining
  • Hovers
  • Find definition
  • find all references
  • rename symbol

Usage

npm install @kusto/monaco-kusto or yarn add @kusto/monaco-kusto

Package content

  • /esm Contains esm version of the library
  • /dev Contains an AMD version of the library
  • /min Contains a minified AMD version of the library

AMD module system:

Example at /samples/amd

  1. Run npm run copyMonacoFilesAMD <path> or yarn copyMonacoFilesAMD <path> where is where you want the monaco and kusto amd modules to be. These files will need to be served as-in.
  2. Using a amd module loader, import vs/language/kusto/monaco.contribution 1. The monaco editors included loader can be made available via a global require require by adding the script tag: <script src="<path>/vs/loader.js"></script>
  3. You should now be able to create monaco editors with language: 'kusto'. The kusto worker can be reached via the monaco global: monaco.languages.kusto.getKustoWorker()
  4. If using typeScript, add "@kusto/monaco-kusto/globalApi" to compilerOptions.types in tsconfig.json`

ESM

Parcel example at /samples/parcel

  1. Configure your bundler so @kusto/monaco-kusto/release/esm/kusto.worker has it's own entry point
  2. Configure the global MonacoEnvironment with either getWorkerUrl or getWorker
  3. You should now be able to create monaco editors with language: 'kusto'. The kusto worker can be reached via the monaco global: monaco.languages.kusto.getKustoWorker()

Setting a schema

There are 2 APIs to set a Kusto schema:

  1. setSchema - the passed schema is of type ClusterType (defined in schema.ts). The database in ROOT.database will be the one in context.
  2. setSchemaFromShowSchema - a method to set a schema from the result of the Kusto query .show schema as json. The result is a list of databases (see interface Result in schema.ts), so when this method is used, it also requires a cluster URI and the name of the database in context.

Contributing

Every PR should come with a test that checks it.

Setting up a dev environment

  1. Install Node.js 20 https://nodejs.org/
  2. Run corepack enable to make the yarn package manager available (https://yarnpkg.com/getting-started/install)
  3. Clone repo and run yarn in repo root
  4. Run yarn watch from /package and a http-server will automatically open the index.html

Build for release

  1. Set CI environment variable to "tru"
  2. Run yarn build

Running unit tests

  • Run yarn test from the package folder to run all unit tests

Running integration tests

  • Run yarn test:integration:install from the root of the project
  • Run yarn test:integration from the package folder to run the tests in headless mode
  • Run yarn test:integration:watch from the package folder to run the tests in a browser and rebuild after each change

Changelog

12.0.5

  • fix: Dark mode colors are now more readable.

12.0.4

  • fix: Explicitly export getRangeHtml from monaco.contribution to fix an issue with parcel build.

12.0.3

  • feat: Upgrade language-service to 0.0.279.

12.0.2

  • fix: Revert the refactor as it caused build issues

12.0.1

  • fix: Resolved a race condition to ensure the semantic tokens provider is registered after setting the language server schema.
  • fix: Fixed an issue where semantic highlighting didn't work on schema change by properly handling provider registration.
  • fix: Disposed of the existing provider whenever a new one is registered to prevent memory leaks.

12.0.0

Breaking Changes

  • Replaced syntax highlighting in Monaco-Kusto. The old method injected CSS for each KQL classified block, causing copy-to-clipboard issues. The new implementation uses:
    • Monarch Tokens: Efficient syntax highlighting leveraging Monaco Editor capabilities.
    • Semantic Syntax Highlighting: Uses Kusto Language Service for context-aware highlighting.
  • Removed useSemanticColorization and useTokenColorization settings.
  • Renamed kusto-dark2 theme to kusto-dark
  • To enable new highlighting, add the following flag when creating the Monaco editor:
    monaco.editor.create(document.getElementById('editor'), {
        // current flags...
        'semanticHighlighting.enabled': true,
    });
  • getRangeHtml is a new public API for retrieving HTML content with syntax highlighting for clipboard data.

11.4.0

  • feat: IntelliSense completion items now maintain the original order from the language service, with the most relevant option automatically focused based on the user's input.

11.3.0

  • fix: Exclude punctuation-only syntax from completion items.

11.2.1

  • feat: Upgrade language-service-next to 11.6.1.

11.2.0

  • feat: Fix bugs related to last version upgrade.
  • feat: Upgrade language-service-next to 11.6.0.

11.1.0

  • feat: Modify the ordering of completion items so that columns always appear at the top.
  • feat: Upgrade language-service-next to 11.5.6.

11.0.0

  • BREAKING CHANGE: Removed the useIntellisenseV2 option; it now defaults to true.
  • feat: upgrade language-service-next to 11.5.5.

10.0.0

  • BREAKING CHANGE: addClusterToSchema know excepts databases as an object with name and alternative name instead of just a string name.

9.0.0

  • feat: support entity groups and database alternative name

7.8.0

  • feat: plotly is now supported in intellisense as a render command

7.7.2

  • fix: KustoWorker#setParameters will now apply changes immediately

7.3.0

  • feat: Kusto worker will now respect MonacoEnvironment.baseUrl configuration when running in a different origin. Checkout our new example for details

7.2.1

  • fix: Added types back to global api

7.2.0

  • Added "themeNames" object to exports which contains the theme we register with monaco: kusto-light, kusto-dark, and kusto-dark2

7.0.1

  • fix: Exported types don't match types used in many cases

7.0.0

  • BREAKING CHANGE: Bumped monaco-editor peer dependency to ~0.37.0
  • fix: "monaco is not defined" errors when consuming esm files
  • Moved types from global interface (monaco.languages.kusto.*) to esm index file import { SomeType } from '@kusto/monaco-kusto. With this, esm consumer no longer need to include @kusto/monaco-kusto/release/monaco.d.ts.
  • ESM output no longer requires MonacoEnvironment.globalApi to be true
  • Moved @kusto/monaco-kusto/release/monaco.d.ts content to @kusto/monaco-kusto/globalApi.d.ts. Original file now references this new one, and will be removed in a future release.

6.2.0

  • Esm output not longer requires self.MonacoEnvironment to be true
  • @kusto/monaco-kusto no exports the same api as monaco.languages.kusto

6.0.0

  • Improved quality of AMD build artifacts
  • BREAKING CHANGE: AMD build artifacts now include a new "main" file that contains shared code
  • BREAKING CHANGE: ESM build artifacts no longer vender dependencies in a "deps" folder. node_modules imports are left as-is, and are now in package.json#dependencies

4.1.8

  • fix: trigger suggestion when previous suggestion selected.

4.1.6

  • fix: low color contrast for foreground/background in suggestWidget for dark theme

4.1.3

  • fix: low color contrast for foreground/background in suggestWidget

4.0.6

  • fix: setSchemaFromShowSchema now supports for external tables.

4.0.3

  • fix: update language service to latest version. fixes issues with scan operator being shown first in completion list.

4.0.2

  • fix: don't do kusto specific highlighting when other language is selected.

4.0.0

  • BREAKING CHANGE: update monaco-editor-core and monaco-editor version to 0.24.0
  • Usage for ESM modules: add globalAPI: true in window.MonacoEnvironment declaration to have monaco on the window

3.3.12

  • fix: external table erroneously shown for materialized views

3.2.11

  • feat: update language service

3.2.10

  • feat: expose custom syntax error message options

3.2.9

  • feat: update language service to support python code strings

3.2.8

  • fix: RenderOptions type missing null property union variants

3.2.7

  • fix: errors are shown twice on hover

3.2.6

  • update language service.

3.2.5

  • Expose formatting options

3.2.4

  • Bug fix: union * is auto-formatted into union*

3.2.3

  • Bug fix: Intellisense doesn't show columns when using this syntax materialized_view("<table name>") | where

3.2.2

  • Bug Fix: In mv-expand kind=array kind is shown with a squiggly error line
  • Update @kusto/language-service-next

3.2.1

  • Colorize public query options.
  • Bug Fix: Format query hangs in some use cases.

3.2.0

  • A function validation fails (shows squiggly red lines), if the function is defined with a parameter that has a default value, but it is used without passing a value for that parameter.
  • Fix bug: Scalars function parameters are always showing "Table expected" error with squiggly error red line when using setSchemaFromShowSchema.

3.1.0-beta.3

  • Missing tokens are no longer added when formatting queries.

3.0.1

  • Fix exception "Cannot read property 'getText' of null TypeError: Cannot read property 'getText' of null at e.parseDocumentV2"
  • Added a sample react project

3.0.0

  • Upgrade to latest monaco (which includes many changes amongst them accessibility improvements)

2.1.15

  • Fix typo in 2.1.14.

2.1.14

  • Add a theme with a darker background color.

2.1.13

  • Fix error "Database has no tables".

2.1.12

  • Allow formatting commands in cursor location.

2.1.11

  • Upgrade to latest bridge.net which fixes an exception from indexOf.

2.1.10

  • Schema with no functions was throwing "Cannot read property 'map' of undefined".

2.1.9

  • Add DocString to onHover tooltip

2.1.6

  • Update language service.

2.1.5

  • Updated render kind typing to include map.

2.1.4

Added

  • Added enableHover option to languages settingss.

2.1.3

Added

  • Added onDidProvideCompletionItems to languages settings as callback function for doComplete operations.

2.1.2

Bug fix

  • Fix getCommandsInDocumentV2 not to take new lines as command.

2.1.1

Bug fix

  • Fix doRangeFormat to work with all kind of user text selection.

2.1.0

Added

  • Added esm release bundles.
  • Added package.json scripts to replace gulp completely.

2.0.9

Bug fix

  • Fix getRenderInfo in cases where there is not with clause.

2.0.8

Bug fix

  • Some more type fixes.

2.0.7

Bug fix

  • Fixed typings.

2.0.6

Added

  • Added getRenderInfo that returns the render command visualization options in a query.

2.0.5

Added

  • Added setParameters that set parameters to the schema without providing the entire schema.

2.0.4

Added

  • Added getReferencedGlobalParams that returns the global (ambient) parameters that are actually being referenced in the query.

2.0.3

Bug fix

  • Control command completion bug fix (updating intellisense library)

2.0.2

Bug fix

  • null pointer exception fix.

2.0.1

Bug fix

  • actually made the change described in 2.0.0

2.0.0 (11/20/2019)

Added

  • [Breaking] Change default to use intellisense V2

1.1.19 (11/18/2019)

Bug fix

  • fix exception in CM & DM clusters when intellisenseV2 is on

1.1.18 (11/18/2019)

Added

  • Abiltiy to get global parameters in scope (getGlobalParams)).

1.1.17 (11/14/2019)

Added

  • Ability to injet global parameters to intellisense (in setSchema)

1.1.16 (10/28/2019)

Added

  • Updated language service
  • Fix corrupt monaco.d.ts

1.1.15 (10/25/2019)

Added

  • Introduce a new function in language service called getQueryParams. it will return an array of all delcared query parameters for the query on cursor.

1.1.14 (9/16/2019)

Bug fix

  • Fix 1.1.13 to return ranges based on 1 (as monaco expects) rather than 0 (as kusto language server returns).

1.1.13 (9/14/2019)

Added

  • Introduce a new function in language service called getCommandAndLocationInContext. it will return both the text and the range of the command in context.

1.0.12 (9/4/2019)

Added

  • Update language service to latest version.

1.0.11 (8/22/2019)

Bug fix

  • Fix IE compatibility issue (remove new URL usage)

1.0.10 (7/1/2019)

Bug fix

  • Fix broken dependency on language service.

1.0.9 (7/1/2019)

Bug fix

  • don't suggest chart types that we do not support yet.

1.0.8 (7/1/2019)

Bug fix

  • don't kill web worker after 2 minutes of inactivity by default. Reason: In exterme cases where schema is very large, trying to stringify the schema in web worker causes an OOM. This is configurable though.

1.0.6 (6/6/2019)

Bug fix

  • Fix broken Diagnostics

1.0.5 (6/5/2019)

Bug fix

  • Fix vulnerability in dependency

1.0.4 (5/31/2019)

Added

  • Support for adding and removing line comments with keyboard shortcut.
  • Support hover

1.0.3 (5/31/2019)

Added

  • Support for go-to definition, find all refrences, rename symbol.

1.0.0 (1/31/2019)

Bug fix

  • [Breaking] put minified versions of language serivce in npm package.
  • [How to migrate]: include the .min (minified files) rather than the unminified files (which are no longer available)
    <script src="%PUBLIC_URL%/monaco-editor/min/vs/language/kusto/bridge.min.js"></script>
    <script src="%PUBLIC_URL%/monaco-editor/min/vs/language/kusto/kusto.javascript.client.min.js"></script>
    <script src="%PUBLIC_URL%/monaco-editor/min/vs/language/kusto/newtonsoft.json.min.js"></script>
    <script src="%PUBLIC_URL%/monaco-editor/min/vs/language/kusto/Kusto.Language.Bridge.min.js"></script>

0.2.2 (12/28/2018)

Bug fix

  • Increase contrast of operators in syntax highlighting.

0.2.2-alpha2 (12/21/2018)

Added

  • Updated dependency @kusto/language-service-next.

0.2.2-alpha (12/21/2018)

Added

  • Updated dependency on @kusto/language-service.

0.2.0 (12/14/2018)

Added

  • [Breaking] Support monaco-editor v15. This removes supprot for pre 15 versions.

0.1.27 (11/14/2018)

Added

  • Abiltiy to suppress completion items from intellisense.

0.1.26 (10/31/2018)

Added

  • Dark theme support (set by calling monaco.editor.setTheme('kusto.dark'))

0.1.25 (10/09/2018)

Bug fix

  • Don't try to run logic on disposed models.

0.1.22 (9/27/2018)

Bug fix

  • Format current command always formatted the 1st command.

0.1.21 (9/23/2018)

Added

  • Removed completion options that arent' curerntly supported.

0.1.19

Bug fix

  • Colorization didn't work when asked to colorize entire document

0.1.18

Added

  • Updated language server dependnecy to latest version.

0.1.16

Bug Fix

  • improve V2 intellisense colorization performance.

0.1.15

Bug Fix

  • V2 intellisense now correctly reverts to V1 for control commands.

0.1.14

Bug Fix

  • Add decimal support to V2 instllisense .

0.1.13

Bug Fix

  • Fix v2 intellisense.

0.1.12

Bug Fix

  • fix quirks in interactions between non-semantic and semantic colorization by not using semantic coloring to color plain text.

0.1.11

Bug Fix

  • Fixed an issue where colorization is working on an older vesion of the document, which results in wrong colorization.

0.1.6

Bug Fixes

  • Intellisense didn't work properly when editing in the middle of a block that is not the 1st block on the page.
  • Monarch colorization now colorizes sub-opeators the same as semantic colorization (which makes the changes less jarring when completing semantic colorization).
  • When switching context, colorization didn't recolorize.
  • (perf) Only colorize the currently edited block(s) - this supports multi-cursor editing
  • (perf) don't deeply parse the entire doc when doing completion. just get the list of commands and then parse the relevant command's all tokns.

0.1.1

Added

  • removed semantic colorization from main thread. From now on basic colorization (schema-unaware) will happen on main thread, and semantic colorization will happen in background thread. This should improve typing performance on long rows, or on large databases.

0.1.0

Added

  • Support for DM intellisense

0.96

Bug Fixes

  • fix incorrect column types

0.95

Bug Fixes

  • upgrade to latest kusto.javascript.client (based on a newer version of bridge.net and the code itself)

0.94

Bug Fixes

  • upgrade to latest Kusto.Language.Bridge (based on a newer version of bridge.net and the code itself)

0.93

Bug Fixes

  • improve performance for function parsing by levaraging new functionality in Kusto.Language.Bridge.

0.91

Bug Fixes

  • Update langauge service dependencies to versions with unified bridge.net version and bridge.json settings.

0.90

Bug Fixes

  • [breaking] Cache clutsser schema in memory. This breaks backward compatibility since it now requries schema to include minor and major version of databases.

0.89

Bug Fixes

  • Upgrade version of Kusto.Language.Bridge so solve some issues.

0.88

Functionality

  • enable get current command logic to V2.

0.86

Bug Fixes

  • Fix ability to set schema using .show schema as json.

0.85

Bug Fixes

  • fix bug that caused diagnostics and colorizaiton to be wrong until first text was typed.

0.76

Bug Fixes

  • fix bug that rendered validation unusable

0.74

Functionality

  • Add colorization support to intellisense API v2

0.73

Functionality

  • Add functions support to intellisense API V2

0.72

Functionality

  • update version of @kusto/language-service-next to 0.0.10, integrated following functionality:
  1. library orders items on its own, so no need to order in monaco-kusto
  2. add support for the cursor not ending in the end of the completion text (like in the 1st parmaeter7 of a function for example)
  3. add '|' after table name
  • Make sure to never parse the same text more than once.

0.71

Functionality

  • add diagnostics (a.k.a error message) support (when v2 parser enabled).

0.70

Functionality

  • add folding (a.k.a outlining) support. one can now fold commands and hide them from screen.

0.69

Functionality

  • [breaking] - introduce new intellisense library (off by default). requires adding the following line to code
<script src="../node_modules/kusto-language-service/kusto.javascript.client.js"></script>

0.68

Bug Fixes

  • [breaking] - Update monaco-editor peer dependency to "^0.12.0" because of bug fixes performed there. Also making the dependency more permissive (allow later minor versions).

0.67

Bug Fixes

  • Add missing dependency bridge newtonsoft.json.js to npm package.

0.65

Functionality

  • updated @kusto/lagnuage-service to latest version. this contains the latest operators, documentation, and charting logic.

0.64

Bug Fixes

  • Added peer dependency for [email protected] so that consumers of the package get a warning if their version of monaco is too old.

0.63

Functionality

  • [breaking] - The package now requires [email protected] to function correctly. adds support for markdown in intellisense documentation.

0.62

Functionality

  • Added setSchemaFromShowSchema: a new method to set a schema from the result of .show schema as json exewcution

0.61

Functionality

  • [breaking]: make setSchema async so that big schemas do not block the ui thread (specifically - tokenization code is running in ui thread so it can block rendering).

0.60

Bug fixes

  • fixed label casing of editor.action.kusto.formatCurrentCommand command.

0.59

Functionality

  • add getAdminCommand method to KustoWorker, which returns an object with a boolean property signifying whether the text is an admin command, and a string property that contains the command without leading comments.

0.58

Bug fixes

  • null pointer exception when creating and destroying multiple monaco models

0.57

Functionality

  • add getClientDirective method to KustoWorker, which returns an object with a boolean property signifying whether the text is a client directive, and a string property that contains the directive without leading comments.

0.54

Bug fixes

  • fix getCurrentCommand bug when there are multiple commands in document

0.53

Bug fixes

  • fix intellisense issue when trying to get suggestions for a new query (2 newlines after previous query)

0.52

Bug fixes

  • command formatting and document formatting now work (ctrl K + ctrl F and alt+shift+F respectively)

0.49

Bug fixes

  • setSchema does not update syntax highlighting

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

monaco-kusto's People

Contributors

aangelisc avatar avneraa avatar dependabot[bot] avatar djilanov avatar fondoger avatar galyech avatar gikoifma avatar gil-koifman avatar izikl avatar iziklisbon avatar lidermanrony avatar maxburs avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar morgilad avatar msftgits avatar noam-shapira avatar razronen avatar sagivf avatar sethreidnz 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monaco-kusto's Issues

System.ArgumentOutOfRangeException: Index and length must refer to a location within the string (Parameter name: length)

We see sporadic uncaught exceptions in production from Kusto worker in our telemetry:

uncaught exception: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string
Parameter name: length
ctor@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:11:88171
$ctor1@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:11:89264
$ctor3@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:11:564533
$ctor4@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:11:566015
indexOf@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:11:282138
CountNonOverlappingSubstrings$1@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:105966
HandleJoins@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:222476
FormatAsString@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:219465
PrettifyQuery@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:109480
eLPx/I</e.prototype.doDocumentformat/</n<@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:1657518
eLPx/I</e.prototype.doDocumentformat/<@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:1657466
then@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:4:24956
eLPx/I</e.prototype.doDocumentformat@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:1657441
eLPx/D</e.prototype.doDocumentFormat@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:1680716
2U0d/</K</t.prototype.fmr@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:4:8369
sj9p/</S</t.prototype._handleMessage@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:71:32371
handleMessage@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:71:32004
sj9p/</m</t.prototype._handleMessage@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:71:30273
sj9p/</m</t.prototype.handleMessage@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:71:29841
sj9p/</S</t.prototype.onmessage@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:71:32083
i/self.onmessage@https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.3e079ac5ceb7e87ca9c8_ef08cf78e49f44e5917f.js:18:1645517

@kusto/language service includes `require("fs")` calls

@kusto/language service includes require("fs") calls which causes bundlers to complain, requiring additional configuration to ignore these calls.

Webpack config looks like this:

export default {
    resolve: {
        fallback: {
            fs: false,
        },
    }
};

Parcel config looks like this:

{
    "alias": {
          "process": false
    }
}

This is especially problematic for Create React App users because it doesn't expose this configuration.

Documentation for Webpack is outdated or incomplete

Description

This project looks great and I'd like to work with it. I've run into issues integrating it though. While I've been able to work through some of them I'm opening this issue to highlight that the documentation for integrating monaco-kusto using webpack seems to be outdated or incomplete.

Here is an example repository that I've set up according to the docs as best as possible: https://github.com/kevinehosford/monaco-kusto-test. Ideally, I'd like to get this example running to see monaco-kusto bundled using webpack, as well as, determine what parts of the documentation need to be updated.

Thanks

Lazy loading of schema

Does this plugin allow for a more lazy , two step strategy for loading the schema, where we provide it only index names first, and then when the user has typed the index name, we are asked for that index's schema? I have a use-case where I have 40-50 tables in my database and each table could potentially have thousands of columns, therefore setting the entire schema in one go could generate extremely large payloads. Is there a way to get around this?

Thanks!

"Unexpected usage" error from t.loadForeignModule

Unable to set schema

Description

languages.kusto.getKustoWorker() never finishes, the promises it returns is stuck at "pending", no error is returned. My goal is to execute the following:

      languages.kusto
        .getKustoWorker()
        .then((kusto) => {
          const model = editor.getModel();
          return model && kusto(model.uri);
        })
        .then((worker) => {
          worker?.setSchema(schema, 'https://help.kusto.windows.net', 'Samples');
        });

I believe this stopped working at some point. This is not working with monaco-editor: 0.31.1 and @kusto/monaco-kusto: 4.1.8 but it worked with monaco-editor 0.21.2 & @kusto/monaco-kusto: 3.2.7.

I suspect something is wrong with the language import since I get this message in the browser console when using kusto:

kustoMode.js:16 Uncaught TypeError: n.getModeId is not a function
    at a (kustoMode.js:16:71379)
    at Array.forEach (<anonymous>)
    at new n (kustoMode.js:16:72566)
    at Object.t.setupMode (kustoMode.js:16:86018)
    at monaco.contribution.js:7:3890
    at Function.s._invokeFactory (loader.js:8:1626)
    at s.complete (loader.js:8:1821)
    at s._onModuleComplete (loader.js:9:991)
    at s._onModuleComplete (loader.js:9:1235)
    at s._resolve (loader.js:9:510)

Any idea how to get this working? This is preventing us from upgrading the editor.

Thanks in advance @lidermanrony

Steps to Reproduce

Hopefully the explanation above is enough but let me know if I can provide more information.

[Steps or usage snippet reproducing the issue]

  1. [First Step]
  2. [Second Step]
  3. [and so on...]
<snippet>

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

System configuration

monaco-kusto version: 4.1.8
monaco-editor version: 0.31.1
Browser:
OS:

Kusto bridge.js conflicts with SystemJS global

Description

I'm not sure this is the right place to report this issue as the code appears to live in @kusto/language-service but I cannot find a repository related to that code.

When loading Kusto, bridge.js is loaded which contains globals.System = {}; which deletes SystemJS from the global/window.

Steps to Reproduce

It's gonna be a bit tricky to reproduce it. I'll try to put a sandbox together if needed however the offending code can be seen here:

image

Here I log System then navigate to a page to load Kusto and then log System again.

image

Expected behavior:
I would expect that loading Kusto doesn't replace the global variable System.

Actual behavior:
Loading Kusto will replace the global variable System.

Reproduces how often:
I can reproduce it 💯 of the time.

System configuration

monaco-kusto version: 7.7.0
monaco-editor version: 0.34.0
Browser: Chrome
OS: Mac OS

Custom function issues

Description

Hi,

I am trying to define a custom similar to the myFunction2 example here:

"name": "myFunction2",

This is my definition of the function:

    {
      name: '$__timeFilter',
      body: '{     StormEvents     | limit 100 }  ',
      inputParameters: [
        {
          name: 'myLimit',
          type: 'System.Int64',
          cslType: 'long',
          docString: 'Demo for a parameter',
          cslDefaultValue: '6',
        },
      ],
      docString: 'Simple demo function',
    } as any,

I have found two issues:

  • My function starts with a dollar sign ($__timeFilter). This causes that when I hit "enter" to autocomplete the function the function name gets removed so I end up only with the parenthesis: ( )
  • My function is supposed to return a boolean but I don't know how to set that. I've tried defining the function with functionKind: 'System.Boolean' (and Boolean and bool) or setting the outputColumns with no luck. I don't see any documentation of how to do that. This causes that the function is detected as an error.

You can see the two issues in the following gif:

Peek 2022-04-11 18-02

Steps to Reproduce

See the description above.

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

System configuration

monaco-kusto version: 5.0.0
monaco-editor version: 0.31.1
Browser:
OS:

Schema is not updated when using the same name

Description

When setting the schema with setSchemaFromShowSchema() the schema is not updated in the kusto worker if the schema uses the same name as before.

Steps to Reproduce

  1. set a schema with name 'Default' with setSchemaFromShowSchema()
  2. Update the schema with name 'Default' with new OrderedColumns of a table
  3. Run setSchemaFromShowSchema() again with the updated schema
  4. Schema is not updated!
monaco.languages.kusto.getKustoWorker().then(workerAccessor => {
    const model = this.editor.getModel();
    workerAccessor(model.uri).then(worker => {
        worker.setSchemaFromShowSchema(schema, '', name);
    });
});

Expected behavior: I expect that the schema is updated with the new columns

Actual behavior: Schema is not upedated

Reproduces how often: 100%

System configuration

monaco-kusto version: 10.0.4
monaco-editor version: ^0.37.1

Bridge.global.System conflicts with systemjs System

Description

Bridge.global.System conflicts with systemjs System.
In kustoLanguageService.ts System accessed as a global variable. This causes conflict with systemjs System variable and this code fails
https://github.com/Azure/monaco-kusto/blob/master/src/languageService/kustoLanguageService.ts#L37

let List = System.Collections.Generic.List$1;

with error TypeError: Cannot read property 'Generic' of undefined.
I found that older version accesses System through the Bridge variable:

var List = Bridge.global.System.Collections.Generic.List$1;

and it works.
This may be fixed either by accessing through the Bridge variable or by redeclaring System variable, like:

let System = (Bridge.global as any).System;

System configuration

monaco-editor version: 0.2.2 (master)
Browser: Chrome
OS: Linux

Cannot read property 'getText' of null

In LogsPortal we get the bellow exception:
It comes from parseDocumentV2 method.

TypeError: Cannot read property 'getText' of null
at e.parseDocumentV2 (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1675235)
at e.doCompleteV2 (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1654319)
at e.doComplete (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1654220)
at e.doComplete (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1680252)
at t.fmr (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:4:8369)
at t._handleMessage (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:32371)
at Object.handleMessage (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:32004)
at t._handleMessage (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:30273)
at t.handleMessage (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:29841)
at t.onmessage (https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:32083) at e.parseDocumentV2

Exception: e is null eLPx/I</e.prototype.parseDocumentV2

In Logs protal we are getting this exception:
from: parseDocumentV2 method.

we are using: "monaco-editor": "0.15.4",

e is null eLPx/I</e.prototype.parseDocumentV2@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:18:1675178 eLPx/I</e.prototype.doCompleteV2@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:18:1654319 eLPx/I</e.prototype.doComplete@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:18:1654220 eLPx/D</e.prototype.doComplete@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:18:1680252 2U0d/</K</t.prototype.fmr@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:4:8369 sj9p/</S</t.prototype._handleMessage@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:71:32371 handleMessage@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:71:32004 sj9p/</m</t.prototype._handleMessage@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:71:30273 sj9p/</m</t.prototype.handleMessage@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:71:29841 sj9p/</S</t.prototype.onmessage@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:71:32083 i/self.onmessage@https://hosting.onecloud.azure-test.net/logsextension/az/kusto.worker.eeaa2ae3e24076c77878_adf5893245a341aab530.js:18:1645517 at e/this.unexpectedErrorHandler/<

typescirpt types are missing for package

Description

typescript typings aren't exported correctly for the package.

Steps to Reproduce

when we have pakcageA depends on packageB depends on Monaco-kusto webpack / parcel will fail compilation for typescript projects

Integrate monaco-kusto in a react app created using CRA.

Description

Hello,
I want to integrate Kusto Language support in my React App Monaco Editor. I have bootstrapped the App using CRA. I referred to the sample here and used react-app-rewired to override my webpack configuration. Here is the relevant section of webpack config -

module.exports = function override(config, env) {
  const cwd = path.resolve();
  config.resolve = {
    alias: {
      ...config.alias,
    'vs/language/kusto/kustoMode': 'kustoMode',
    'bridge.min': '@kusto/monaco-kusto/release/esm/bridge.min',
    'kusto.javascript.client.min': '@kusto/monaco-kusto/release/esm/kusto.javascript.client.min.js',
    'Kusto.Language.Bridge.min': '@kusto/monaco-kusto/release/esm/Kusto.Language.Bridge.min.js',
    'Kusto': '@kusto/monaco-kusto/release/esm/Kusto.Language.Bridge.min.js',
    'monaco.contribution': path.resolve(__dirname, '../node_modules/@kusto/monaco-kusto/release/esm/monaco.contribution.js')
    }
  };
...

This does not work and I get the error Cannot find module 'monaco.contribution' or its corresponding type declarations..

Does monaco-kusto work with CRA and react-app-rewired? If yes, it will be helpful to have a sample of the same added to the samples section.

System configuration

"@kusto/monaco-kusto": "2.1.14",
"@monaco-editor/react": "^4.5.2",
"monaco-editor": "^0.44.0",

Compile failure in react project.

Tried the sample:

ERROR in ./node_modules/@kusto/language-service/bridge.min.js 26013:40-53
Module not found: Error: Can't resolve 'fs' in 'C:\repo\my-react-project\node_modules\@kusto\language-service'

webpack compiled with 1 error and 1 warning
No issues found.

Could you please give us a minimal sample for projects created with create-react-app?

System configuration

monaco-kusto version: 10.0.7
monaco-editor version: 0.44.0
Browser:
OS:

Is there an up to date changelog somewhere?

Description

Hello! I'm looking to bump @kusto/monaco-kusto to latest (10.0.8 at time of writing) but I'm struggling to find a changelog that details what was changed. The readme has a changelog until 7.8.0 and there are no github releases or tags other than a major zero release. We're currently relying on 7.7.0 and would find it helpful to see what changed (particularly breaking changes) between versions to decide the effort and benefits of doing so (other than just being up to date).

Steps to Reproduce

N/A

Expected behavior: To have a changelog that details changes between releases

Actual behavior: Can refer to changelog in readme until 7.8.0. Only option to discover changes beyond 7.8.0 is to look through closed pull requests.

Raw query editor not showing schema of dynamic fields

Description

Raw Query Editor not showing schema of dynamic fields even though query builder does.
Originally reported at grafana/azure-data-explorer-datasource#409 but was referred here.

Steps to Reproduce

  1. given an ADX datasource with a table that contains a dynamic field with nested fields
    Example:
Col1 Col2 Col3
value1 value2 {count: 1}
  1. go to "Explore"
  2. Make sure that the visual builder shows "Col3.count" in the fields list
  3. switch to raw KQL editor
  4. type "Col3."
  5. The suggestions window doesn't show "count" as an option

Expected behavior: [What you expect to happen]
The visual query builder does show nested fields inside dynamic field so i expected that the raw editor will behave the same.

Actual behavior: [What actually happens]
When writing a query using the raw KQL editor the auto-completion suggestions are not showing nested schema of dynamic fields.

Reproduces how often: [What percentage of the time does it reproduce?]
100%

System configuration

monaco-kusto version: -
monaco-editor version: 0.17.0
Browser: Edge
OS: macOS

Intellisense v2 doesn't work

Description

Enabling useIntellisenseV2 trows an exception:

Uncaught (in promise) 
{
  HResult: -2147467261
  InnerException: null
  Message: "Value cannot be null.↵Parameter name: type"
  ParamName: "type"
  StackTrace: "Error: Value cannot be null.
    at $ctor1.ctor (webpack://monaco/./node_modules/@kusto/language-service/bridge.js?:5436:31)
    at $ctor1 (webpack://monaco/./node_modules/@kusto/language-service/bridge.js?:5507:39)
    at $ctor1.$ctor3 (webpack://monaco/./node_modules/@kusto/language-service/bridge.js?:32303:47)
    at new $ctor1 (webpack://monaco/./node_modules/@kusto/language-service/bridge.js?:32322:49)
    at eval (webpack://monaco/./node_modules/@kusto/language-service-next/Kusto.Language.Bridge.js?:21774:27)
    at new ctor (webpack://monaco/./node_modules/@kusto/language-service-next/Kusto.Language.Bridge.js?:21775:18)
    at createColumnSymbol (webpack://monaco/./src/languageService/kustoLanguageService.ts?:849:20)
    at eval (webpack://monaco/./src/languageService/kustoLanguageService.ts?:868:73)
    at Array.map (<anonymous>)
    at createTableSymbol (webpack://monaco/./src/languageService/kustoLanguageService.ts?:868:45)"
}

This error caused by wrong schema normalization:
https://github.com/Azure/monaco-kusto/blob/master/src/languageService/kustoLanguageService.ts#L619

columns: OrderedColumns.map(({Name, Type, CslType}: s.showSchema.Column) => ({
    name: Name,
    type: CslType,
}))

Code above produces columns with undefined type.

Guess, it may be fixed by assigning proper value to type:

columns: OrderedColumns.map(({Name, Type, CslType}: s.showSchema.Column) => ({
    name: Name,
    type: Type,
    cslType: CslType,
}))

Steps to Reproduce

Enable useIntellisenseV2 for kusto:

   monaco.languages['kusto'].kustoDefaults.setLanguageSettings({
     includeControlCommands: true,
     newlineAfterPipe: true,
     useIntellisenseV2: true,
     useSemanticColorization: true,
   });

System configuration

monaco-editor version: 0.2.2 (master)
Browser: Chrome
OS: Linux

kusto.javascript.client.min.js Information Disclosure

Hi Team,
We got one security issue regarding this kusto.javascript.client.min.js file.
In this file we have we have below statements which are seems to be username and password

namic](./scalar-data-types/dynamic.md) that included the URL components: Scheme, Host, Port, Path, Username, Password, Query Parameters, Fragment.",'```\r\nT | extend Result = parse_url("scheme://username:password@host:1234/this/is/a/path?k1=v1&k2=v2#fragment")

Could you please confirm whether it is NOT a security issue and expected statement here (it is a just reference statement).

Upgrade to support Monaco Editor 0.15.x

Description

Upgrade to support Monaco Editor 0.15.x

There are multiple breaking changes in Monaco Editor 0.15 including CompletionItemProvider interface change and WinJS promise removal.
This plugin needs to be upgraded to support the new version.

Steps to Reproduce

When run current monaco-kusto against Monaco Editor 0.15.x, the suggestion is totally broken.

  1. Open the test/index.html page
  2. Input some characters
  3. Open browser console

Expected behavior: Suggestions should show up without any error

Actual behavior: No suggestion shows, and error thrown in console:

Uncaught TypeError: token.onCancellationRequested is not a function
    at wireCancellationToken (/D:/repos/monaco-kusto/release/dev/kustoMode.js:18944)
    at CompletionAdapter.provideCompletionItems (/D:/repos/monaco-kusto/release/dev/kustoMode.js:18782)
    at suggest.ts:81
    at Array.map (<anonymous>)
    at suggest.ts:75
    at loop (async.ts:186)
    at Object.first (async.ts:197)
    at Object.provideSuggestionItems (suggest.ts:116)
    at SuggestModel.trigger (suggestModel.ts:393)
    at suggestModel.ts:334

Reproduces how often: Always

System configuration

monaco-editor version: 0.15.6
Browser: Chrome 71.0
OS: Windows 10 1809

samples/esm-webpack-react doest run

Description

I am working on using this in project and trying to get the esm-webpack sample working and getting errors.

Steps to Reproduce

  1. Clone the repo
  2. Run yarn install
  3. Run cd samples/esm-webpack-react
  4. Run yarn serve

Expected behavior:

To be able to see the sample running in the browser

Actual behavior:

It launches the server but I get the following error:

CleanShot 2023-11-29 at 10 38 08

System configuration

"@kusto/monaco-kusto": "workspace:*",
"monaco-editor": "^0.41.0",
Browser: Edge
OS: Mac

Exception: Cannot read property 'getText' of null TypeError: Cannot read property 'getText' of null at e.parseDocumentV2

Description

Get the following exceptions in Logs blade:
Cannot read property 'getText' of null TypeError: Cannot read property 'getText' of null at e.parseDocumentV2 (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1675235) at e.doCompleteV2 (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1654319) at e.doComplete (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1654220) at e.doComplete (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:18:1680252) at t.fmr (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:4:8369) at t._handleMessage (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:32371) at Object.handleMessage (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:32004) at t._handleMessage (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:30273) at t.handleMessage (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:29841) at t.onmessage (https://logsextension.hosting.portal.azure.net/logsextension/az/kusto.worker.58fc3e3c6ecf67e57069_28b25f6068a46082d38a.js:71:32083) at e.parseDocumentV2

System configuration

monaco-kusto version: 2.1.4
monaco-editor version: 0.15.4
Browser: Chrome 83.0

Errors not always rendered

Description

Syntax/semantic errors are not always renderered. The root cause seems to be this line, where waitForAnalysis is set false in GetDiagnostics, leading to returning only pre-computed results. Removing false from the GetDiagnostics call fixes the issue. Any idea why false is passed there?

Steps to Reproduce

Using the test page from this repo:

  1. Type a few random characters to change StormEvents into an invalid data source name in the default query
  2. See that there is no errors rendered
  3. Change the last operator from count to counta
  4. See that errors are now rendered

Expected behavior: Errors should be rendered always

Actual behavior: Errors are rendered intermittently

Reproduces how often: 100%

System configuration

monaco-kusto version: 5.1.3
monaco-editor version: 0.33.0
Browser: Chrome
OS: Mac OS 11.6.2

Release does not have esm files

Description

image

Release does not have esm files

Steps to Reproduce

npm install @kusto/monaco-kusto

System configuration

monaco-kusto version: 0.0.65
monaco-editor version: 0.44.0
Browser:
OS:

Plugins are ignored in call to setSchemaFromShowSchema

Description

We have some custom plugins we are using and would like for them to appear as valid syntax in the editor. I don't see anything in the docs that shows how to do that, but the fact that Plugins are listed there makes it seem like they would be used when initializing the schema. When I look at the code I see that in normalizing the schema, only the Databases attribute is referenced, and Plugins are ignored. Is this something that is yet to be implemented? Or is there another way to configure this?

I have also asked this question: https://stackoverflow.com/questions/77246252/how-can-i-display-user-defined-plugins-for-kusto-in-the-monaco-editor

Steps to Reproduce

  1. Pass Schema.Result object with a defined Plugin to kusto worker via setSchemaFromShowSchema
  2. Reference plugin in my app running Monaco Editor
{
  "Plugins": [
    {
      "Name": "slice",
      "InputParameters": [],
      "Body": "",
      "Folder": "",
      "DocString": "I am a doc string",
      "FunctionKind": "Unknown",
      "OutputColumns": []
    }
  ],
  "Databases": {
    "baz": {
      "Name": "baz",
      "Tables": {...

Expected behavior: The Plugin reference appears in intellisense autocomplete and does not appear as bad syntax

Actual behavior: The Plugin reference is treated as a syntax error

Screenshot 2023-10-06 at 12 32 05 PM

Reproduces how often: 100%

System configuration

monaco-kusto version: 7.8.0
monaco-editor version: 0.40.0
Browser: Chrome
OS: Mac

Colorization doesn't work in latest master.

Description

Colorization fails with error

TypeError: Cannot set property End of #<ctor> which has only a getter

which caused by https://github.com/Azure/monaco-kusto/blob/master/src/languageService/kustoLanguageService.ts#L1004

range variable has a type Kusto.Language.Editor.ClassifiedRange which has read-only property End:

// node_modules/@kusto/language-service-next/Kusto.Language.Bridge.js

Bridge.define("Kusto.Language.Editor.ClassifiedRange", {
        $kind: "struct",
...
        props: {
...
            /**
             * The starting text position of the classified range.
             *
             * @instance
             * @public
             * @memberof Kusto.Language.Editor.ClassifiedRange
             * @function Start
             * @type number
             */
            Start: 0,
...
            /**
             * The end of the classification range.
             *
             * @instance
             * @public
             * @readonly
             * @memberof Kusto.Language.Editor.ClassifiedRange
             * @function End
             * @type number
             */
            End: {
                get: function () {
                    return ((this.Start + this.Length) | 0);
                }
            }
        },
...
    });

So this issue can be fixed by removing this line (this line is not necessary actually, since End calculated in getter) :

range.End = cslCommandToken.AbsoluteEnd + offset;

Steps to Reproduce

Create new monaco instance with the following options:

monaco.languages['kusto'].kustoDefaults.setLanguageSettings({
      includeControlCommands: true,
      newlineAfterPipe: true,
      useIntellisenseV2: false,
      useSemanticColorization: true,
});

System configuration

monaco-editor version: 0.2.2 (from master)
Browser: Chrome
OS: Linux

kustoMode.js:120 Uncaught TypeError: Cannot read property 'IntelliSense' of undefined

Description

Hi, I have cloned the latest repo from master branch and trying to test "/test/index.html" page with "serve ." command. But when the editor is being loaded, I am getting this below error and the intellisense not working.

image

Here is the index.html file, I am trying to test,

index.html.txt

Please help me out to resolve this issue.

Steps to Reproduce

[Steps or usage snippet reproducing the issue]

  1. [First Step]
  2. [Second Step]
  3. [and so on...]
<snippet>

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

System configuration

monaco-kusto version: 0.x.y
monaco-editor version: 0.X.Y
Browser:
OS:

installing @kusto/monaco-editor via npm not working

Description

When trying to install the @kusto/monaco-editor via npm, it is unable to find that package in the registry

Output from running NPM:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '@kusto/monaco-editor'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session b5dc8eef4439a02e
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 404 https://registry.npmjs.org/@kusto%2fmonaco-editor 803ms
8 http fetch GET 404 https://registry.npmjs.org/@kusto%2fmonaco-editor 196ms
9 silly fetchPackageMetaData error for @kusto/monaco-editor@latest 404 Not Found - GET https://registry.npmjs.org/@kusto%2fmonaco-editor - Not found
10 timing stage:rollbackFailedOptional Completed in 1ms
11 timing stage:runTopLevelLifecycles Completed in 4775ms
12 verbose stack Error: 404 Not Found - GET https://registry.npmjs.org/@kusto%2fmonaco-editor - Not found
12 verbose stack at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:117:15
12 verbose stack at processTicksAndRejections (internal/process/task_queues.js:95:5)
13 verbose statusCode 404
14 verbose pkgid @kusto/monaco-editor@latest
15 verbose cwd /workspaces/clarity-internal
16 verbose Linux 5.15.49-linuxkit
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "@kusto/monaco-editor"
18 verbose node v14.21.3
19 verbose npm v6.14.18
20 error code E404
21 error 404 Not Found - GET https://registry.npmjs.org/@kusto%2fmonaco-editor - Not found
22 error 404
23 error 404 '@kusto/monaco-editor@latest' is not in the npm registry.
24 error 404 You should bug the author to publish it (or use the name yourself!)
25 error 404 Note that you can also install from a
26 error 404 tarball, folder, http url, or git url.
27 verbose exit [ 1, true ]

Monaco-kusto doesn't support absolute paths

Hi I want to load this package on our website, but I am getting into some issues.

The issue I am facing is that when I am trying to load the webworker (workerMain.js) from a blob and I am receiving a lot of errors due to relative path loading.
(I am loading it through a blob because of CORS issue I have on loading scripts).

Once I load it from the blob the KustoWorker is called through a relative path and then the bridge.min etc. I tried to change it to an absolute path in the kustoMode.js and the kustoWorker.js but then the workaccessor doesn’t return.
image

image

kustoMode.js:
image

kustoWorker.js:
image

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.