Skip to content

Commit

Permalink
upgrade language service next and remove all sorting logic from our e…
Browse files Browse the repository at this point in the history
…nd (#469)

This PR resolves all sorting issues:

- Upgraded language-service-next to version 11.6.0 in order to provide
OrderText for each completion item and includes a fix for the completion
item order when converting from C# to TypeScript.
- Removed our implementation of creating a sorting text for each
completion item.
- Eliminated our logic for re-sorting completion items, as it is no
longer needed.
- Upgrade the packages to 11.2.0.

I LOVE DELETING CODE!
  • Loading branch information
morgilad authored Jun 29, 2024
1 parent a4f4a80 commit be6b4e5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 106 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,20 @@ Every PR should come with a test that checks it.

## Changelog

### 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.
- 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.
- feat: upgrade language-service-next to 11.5.5.

### 10.0.0

Expand Down
4 changes: 2 additions & 2 deletions package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kusto/monaco-kusto",
"version": "11.1.0",
"version": "11.2.0",
"description": "CSL, KQL plugin for the Monaco Editor",
"author": {
"name": "Microsoft"
Expand Down Expand Up @@ -73,7 +73,7 @@
},
"dependencies": {
"@kusto/language-service": "0.0.278",
"@kusto/language-service-next": "11.5.6",
"@kusto/language-service-next": "11.6.0",
"lodash-es": "^4.17.21",
"vscode-languageserver-types": "^3.17.4",
"xregexp": "^5.1.1"
Expand Down
31 changes: 0 additions & 31 deletions package/src/languageServiceManager/competionItemSort.ts

This file was deleted.

62 changes: 0 additions & 62 deletions package/src/languageServiceManager/completionItemSort.spec.ts

This file was deleted.

6 changes: 2 additions & 4 deletions package/src/languageServiceManager/kustoLanguageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { Database, EntityGroup, getCslTypeNameFromClrType, getEntityDataTypeFrom
import type { RenderOptions, VisualizationType, RenderOptionKeys, RenderInfo } from './renderInfo';
import type { ClusterReference, DatabaseReference } from '../types';
import { Mutable } from '../util';
import { createSortingText, sortByMatchTextKeepingKindOrder } from './competionItemSort';

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

Expand Down Expand Up @@ -419,8 +418,7 @@ class KustoLanguageService implements LanguageService {
});
}
const itemsAsArray = this.toArray<k2.CompletionItem>(completionItems.Items);
const sortedArray = sortByMatchTextKeepingKindOrder(itemsAsArray);
let items: ls.CompletionItem[] = sortedArray
let items: ls.CompletionItem[] = itemsAsArray
.filter(
(item) =>
!(
Expand Down Expand Up @@ -460,7 +458,7 @@ class KustoLanguageService implements LanguageService {
// Changing the first letter to be lower case, to ignore case-sensitive matching
lsItem.filterText = kItem.MatchText.charAt(0).toLowerCase() + kItem.MatchText.slice(1);
lsItem.kind = this.kustoKindToLsKindV2(kItem.Kind);
lsItem.sortText = createSortingText(index);
lsItem.sortText = kItem.OrderText;
lsItem.insertTextFormat = format;
lsItem.detail = helpTopic ? helpTopic.ShortDescription : undefined;
lsItem.documentation = helpTopic
Expand Down
2 changes: 2 additions & 0 deletions package/tests/unit/builders/KustoCompletionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function kustoCompletionItemBuilder() {
AfterText: null,
EditText: null,
Retrigger: null,
OrderText: null,
WithKind: null,
WithDisplayText: null,
WithMatchText: null,
Expand All @@ -21,6 +22,7 @@ export function kustoCompletionItemBuilder() {
WithEditText: null,
WithAfterText: null,
WithRetrigger: null,
WithOrderText: null,
};

const builder = {
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2016,10 +2016,10 @@ __metadata:
languageName: node
linkType: hard

"@kusto/language-service-next@npm:11.5.6":
version: 11.5.6
resolution: "@kusto/language-service-next@npm:11.5.6"
checksum: ba88060e89bfd9f80846e2b5fe5df672ad3f3a38ae247fda7d8fad0700f6767767526772c499593a819202b7554de0e58d26512162dce4a4f7b5cc8acfc68dec
"@kusto/language-service-next@npm:11.6.0":
version: 11.6.0
resolution: "@kusto/language-service-next@npm:11.6.0"
checksum: 59be2aa1cf862fc291473c4ff860ccccd518165452e0263d1ce8d3581caee03dcabb7973d49c61cb5b1d428f3e1818c78f995401d70134cd456d2e07f05566ba
languageName: node
linkType: hard

Expand Down Expand Up @@ -2056,7 +2056,7 @@ __metadata:
"@babel/preset-typescript": ^7.22.15
"@faker-js/faker": ^8.4.1
"@kusto/language-service": 0.0.278
"@kusto/language-service-next": 11.5.6
"@kusto/language-service-next": 11.6.0
"@playwright/test": ^1.44.0
"@rollup/plugin-alias": ^5.0.0
"@rollup/plugin-babel": ^6.0.3
Expand Down

0 comments on commit be6b4e5

Please sign in to comment.