updated monaco , Added intellisense and linting to report editor js

This commit is contained in:
2022-01-12 20:05:10 +00:00
parent 879ba591f1
commit 8fe3a31d70
6 changed files with 110 additions and 17 deletions

View File

@@ -315,6 +315,7 @@
v-if="showWiki()"
:cols="currentView == view.SPLIT_VIEW ? 6 : 12"
>
<!-- eslint-disable vue/no-v-html -->
<div
:style="wikiStyle()"
class="markdown-body"

View File

@@ -340,6 +340,7 @@
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{ item.name }}</v-list-item-title>
<!-- eslint-disable vue/no-v-html -->
<v-list-item-subtitle
v-html="item.viz"
></v-list-item-subtitle>

View File

@@ -554,6 +554,30 @@ export default {
await fetchReportData(vm);
//---------------
//setup the editor and models
//https://github.com/microsoft/monaco-editor/issues/2147
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
noSemanticValidation: false,
noSyntaxValidation: false,
noSuggestionDiagnostics: false,
diagnosticCodesToIgnore: [2393]
});
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
target: monaco.languages.typescript.ScriptTarget.ES6,
allowNonTsExtensions: true
});
monaco.languages.typescript.javascriptDefaults.addExtraLib(
[
"export declare global function ayGetTranslations(keys:Array): promise<void>;",
"export declare global function ayPrepareData(ayData:object): ayPrepareData: object;",
"export declare global function ayGroupByKey(reportDataArray:Array, groupByKeyName:string): Array",
"export declare global function ayGetFromAPI(route:string,token?:string): promise<object>;",
"export declare global function ayPostToAPI(route:string,data?:object,token?:string): promise<result:object>;",
"export declare global function ayGetTranslations(keys:Array): promise<void>;",
"export declare global declare namespace Handlebars {export function registerHelper(name: string, fn: HelperDelegate): void; export function registerHelper(name: HelperDeclareSpec): void;}"
].join("\n"),
"filename/facts.d.ts"
);
//Created editor models for each type of report element that can be edited
vm.editData.template.model = monaco.editor.createModel(
@@ -583,6 +607,7 @@ export default {
editor = monaco.editor.create(document.getElementById("editContainer"), {
model: vm.editData.template.model
});
//save the initial state because we're going to move away from it immediately
vm.editData.template.state = editor.saveViewState();