Some progress.

This commit is contained in:
Henning Dieterichs
2019-08-07 17:23:34 +02:00
parent 85692ac720
commit ec664bad91
21 changed files with 4943 additions and 286 deletions

View File

@@ -1,4 +1,10 @@
import { contract, notificationContract, types } from "@hediet/typed-json-rpc";
import {
contract,
notificationContract,
types,
requestContract,
JSONObject,
} from "@hediet/typed-json-rpc";
import {
DataExtractionResult,
DataExtractorId,
@@ -22,6 +28,57 @@ export type DataExtractionState =
result: DataExtractionResult;
};
// https://microsoft.github.io/debug-adapter-protocol/specification#CompletionItem
type CompletionItemType =
| "method"
| "function"
| "constructor"
| "field"
| "variable"
| "class"
| "interface"
| "module"
| "property"
| "unit"
| "value"
| "enum"
| "keyword"
| "snippet"
| "text"
| "color"
| "file"
| "reference"
| "customcolor";
export interface CompletionItem {
/**
* The label of this completion item. By default this is also the text that is inserted when selecting this completion.
*/
label: string;
/**
* If text is not falsy then it is inserted instead of the label.
*/
text?: string;
/**
* The item's type. Typically the client uses this information to render the item in the UI with an icon.
*/
type?: CompletionItemType;
/**
* This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added.
* If missing the text is added at the location specified by the CompletionsRequest's 'column' attribute.
*/
start?: number;
/**
* This value determines how many characters are overwritten by the completion text.
* If missing the value 0 is assumed which results in the completion text being inserted.
*/
length?: number;
}
export const debugVisualizerUIContract = contract({
client: {
updateState: notificationContract({
@@ -43,5 +100,15 @@ export const debugVisualizerUIContract = contract({
}),
refresh: notificationContract({}),
openInBrowser: notificationContract({}),
getCompletions: requestContract({
params: types.type({
text: types.string,
column: types.number,
}),
result: types.type({
completions: types.array(unchecked<CompletionItem>()),
}),
}),
},
});