Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
#22 - variable auto-complete example
Browse files Browse the repository at this point in the history
  • Loading branch information
CullieM committed May 24, 2021
1 parent 546b0a3 commit 962a45a
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions src/YarnSpinner/yarnSpinnerMonarch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,10 @@

/* Currently unable to import .ts file into renderer, likely a webpack issue. https://webpack.js.org/guides/typescript/
* Monaco Custom Language Documentation: https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages
* Yarn Spinner Documentation: https://yarnspinner.dev/docs/syntax/
* JS RegExp Documentation: https://www.w3schools.com/jsref/jsref_obj_regexp.asp
* Typescript TokensProvider: https://github.com/microsoft/monaco-languages/blob/main/src/typescript/typescript.ts
*/
import * as monaco from 'monaco-editor';

/*
file
header
body
commands
x strings
x keywords
x variables
x numbers
x operators
>> pop
options
x text
x interpolation
x commands
3
dialogue
x commands
x interpolation
*/

//Exports configuration monaco/monarch tokenisation for Yarn Spinner
export const tokensWIP =
{
Expand Down Expand Up @@ -376,6 +351,20 @@ export const completions = {
documentation: 'Create new node',
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
}];

var word = "test" //model.getValueInRange({startLineNumber: 1, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column});

var match = word.match(/[A-Za-z_]+[\.]*[A-Za-z_]*/);

if(match)
{
suggestions.push(
{label: word,
kind: monaco.languages.CompletionItemKind.Snippet,
insertText: word,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,}
);
}
return { suggestions: suggestions };
}
};

0 comments on commit 962a45a

Please sign in to comment.