This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zpa_backoff_test $ make start | |
terraform init && terraform apply --auto-approve | |
Initializing the backend... | |
Initializing provider plugins... | |
- Finding zscaler.com/zpa/zpa versions matching "1.0.0"... | |
- Installing zscaler.com/zpa/zpa v1.0.0... | |
- Installed zscaler.com/zpa/zpa v1.0.0 (unauthenticated) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as monaco from "monaco-editor-core"; | |
import { WorkerAccessor } from "./setup"; | |
export default class TodoLangFormattingProvider implements monaco.languages.DocumentFormattingEditProvider { | |
constructor(private worker: WorkerAccessor) { | |
} | |
provideDocumentFormattingEdits(model: monaco.editor.ITextModel, options: monaco.languages.FormattingOptions, token: monaco.CancellationToken): monaco.languages.ProviderResult<monaco.languages.TextEdit[]> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format(code: string): Promise<string>{ | |
return Promise.resolve(this.languageService.format(code)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format(code: string): string{ | |
// if the code contains errors, no need to format, because this way of formating the code, will remove some of the code | |
// to make things simple, we only allow formatting a valide code | |
if(this.validate(code).length > 0) | |
return code; | |
let formattedCode = ""; | |
const ast: TodoExpressionsContext = parseAndGetASTRoot(code); | |
ast.children.forEach(node => { | |
if (node instanceof AddExpressionContext) { | |
// if a Add expression : ADD TODO "STRING" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkSemanticRules(ast: TodoExpressionsContext): ITodoLangError[] { | |
const errors: ITodoLangError[] = []; | |
const definedTodos: string[] = []; | |
ast.children.forEach(node => { | |
if (node instanceof AddExpressionContext) { | |
// if a Add expression : ADD TODO "STRING" | |
const todo = node.STRING().text; | |
// If a TODO is defined using ADD TODO instruction, we can re-add it. | |
if (definedTodos.some(todo_ => todo_ === todo)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
monaco.languages.onLanguage(languageID, () => { | |
monaco.languages.setMonarchTokensProvider(languageID, monarchLanguage); | |
monaco.languages.setLanguageConfiguration(languageID, richLanguageConfiguration); | |
const client = new WorkerManager(); | |
const worker: WorkerAccessor = (...uris: monaco.Uri[]): Promise<TodoLangWorker> => { | |
return client.getLanguageServiceWorker(...uris); | |
}; | |
//Call the errors provider | |
new DiagnosticsAdapter(worker); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as monaco from "monaco-editor-core"; | |
import { WorkerAccessor } from "./setup"; | |
import { languageID } from "./config"; | |
import { ITodoLangError } from "../language-service/TodoLangErrorListener"; | |
export default class DiagnosticsAdapter { | |
constructor(private worker: WorkerAccessor) { | |
const onModelAdd = (model: monaco.editor.IModel): void => { | |
let handle: any; | |
model.onDidChangeContent(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as monaco from "monaco-editor-core"; | |
import Uri = monaco.Uri; | |
import { TodoLangWorker } from './todoLangWorker'; | |
import { languageID } from './config'; | |
export class WorkerManager { | |
private worker: monaco.editor.MonacoWebWorker<TodoLangWorker>; | |
private workerClientProxy: Promise<TodoLangWorker>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(window as any).MonacoEnvironment = { | |
getWorkerUrl: function (moduleId, label) { | |
if (label === languageID) | |
return "./todoLangWorker.js"; | |
return './editor.worker.js'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
entry: { | |
app: './src/index.tsx', | |
"editor.worker": 'monaco-editor-core/esm/vs/editor/editor.worker.js', | |
"todoLangWorker": './src/todo-lang/todolang.worker.ts' | |
}, | |
output: { | |
globalObject: 'self', | |
filename: (chunkData) => { | |
switch (chunkData.chunk.name) { | |
case 'editor.worker': |
NewerOlder