-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Service Cutter generator support for VS Code extension (#6)
- Loading branch information
Showing
12 changed files
with
240 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cmlVersion=5.13.0 | ||
cmlVersion=5.13.1-SNAPSHOT | ||
gradleNodePluginVersion=2.2.4 | ||
nodeVersion=10.16.0 | ||
npmVersion=6.10.2 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"comments": { | ||
"lineComment": "//", | ||
"blockComment": [ "/*", "*/" ] | ||
}, | ||
"brackets": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"] | ||
], | ||
"autoClosingPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["\"", "\""], | ||
["'", "'"] | ||
], | ||
"surroundingPairs": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"], | ||
["\"", "\""], | ||
["'", "'"] | ||
] | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* SCL generator commands | ||
*/ | ||
|
||
import { commands, window, workspace, Uri, OpenDialogOptions, InputBoxOptions, TextDocumentShowOptions, ViewColumn } from "vscode"; | ||
import * as editor from "../editors/scl-editor"; | ||
import { CommandType } from "./command" | ||
|
||
export function generateServiceCutterUserRepresentationJSONFile(): CommandType { | ||
return generate('scl.generate.user.representations.json.file', 'The JSON file has been generated into the src-gen folder.'); | ||
} | ||
|
||
function generate(command: string, successMessage: string, ...additionalParameters: any[]): CommandType { | ||
return async () => { | ||
if (editor.isNotSCLEditor()) | ||
return; | ||
|
||
if (editor.documentHasURI()) { | ||
console.log(`Send command ${command} to SCL language server.`); | ||
const returnVal: string = await commands.executeCommand(command, window.activeTextEditor.document.uri.toString(), additionalParameters); | ||
if (returnVal.startsWith('Error occurred:')) { | ||
window.showErrorMessage(returnVal); | ||
} else { | ||
window.showInformationMessage(successMessage); | ||
} | ||
} | ||
}; | ||
} |
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Helper functions for SCL editor | ||
*/ | ||
|
||
import { window, Uri } from "vscode"; | ||
|
||
export function isNotSCLEditor(): boolean { | ||
let activeEditor = window.activeTextEditor; | ||
return !activeEditor || !activeEditor.document || activeEditor.document.languageId !== 'scl'; | ||
} | ||
|
||
export function documentHasURI(): boolean { | ||
return window.activeTextEditor.document.uri instanceof Uri; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"name": "Service Cutter DSL", | ||
"scopeName": "source.scl", | ||
"fileTypes": [ | ||
"scl" | ||
], | ||
"repository": { | ||
"general": { | ||
"patterns": [ | ||
{ | ||
"include": "#linecomment" | ||
}, | ||
{ | ||
"include": "#blockcomment" | ||
}, | ||
{ | ||
"include": "#useCaseKeywords" | ||
}, | ||
{ | ||
"include": "#compatibilitiesKeywords" | ||
}, | ||
{ | ||
"include": "#commonSCLKeywords" | ||
}, | ||
{ | ||
"include": "#stringsSingle" | ||
}, | ||
{ | ||
"include": "#stringsDouble" | ||
} | ||
] | ||
}, | ||
"linecomment": { | ||
"name": "comment.line.double-dash.scl", | ||
"begin": "(^[ \\t]+)?(?=//)", | ||
"end": "(?=$)" | ||
}, | ||
"blockcomment": { | ||
"name": "comment.block.scl", | ||
"begin": "/\\*(\\*)?(?!/)", | ||
"end": "\\*/" | ||
}, | ||
"useCaseKeywords": { | ||
"name": "keyword.control.scl", | ||
"match": "\\b(UseCase|isLatencyCritical|true|reads|writes)\\b" | ||
}, | ||
"compatibilitiesKeywords": { | ||
"name": "keyword.control.scl", | ||
"match": "\\b(Compatibilities|AvailabilityCriticality|characteristic|ConsistencyCriticality|ContentVolatility|SecurityCriticality|StorageSimilarity|StructuralVolatility)\\b" | ||
}, | ||
"commonSCLKeywords": { | ||
"name": "keyword.control.scl", | ||
"match": "\\b(Aggregate|Entity|PredefinedService|SecurityAccessGroup|SeparatedSecurityZone|SharedOwnerGroup)\\b" | ||
}, | ||
"stringsSingle": { | ||
"name": "string.quoted.single.scl", | ||
"begin": "'", | ||
"end": "'" | ||
}, | ||
"stringsDouble": { | ||
"name": "string.quoted.double.scl", | ||
"begin": "\"", | ||
"end": "\"" | ||
} | ||
}, | ||
"patterns": [ | ||
{ | ||
"include": "#general" | ||
} | ||
] | ||
} |