Skip to content

Commit

Permalink
Merge pull request #47 from AmpersandTarski/development
Browse files Browse the repository at this point in the history
Release 0.3.10
  • Loading branch information
hanjoosten committed Jan 20, 2020
2 parents 1fd5764 + d7cbd55 commit ca66e78
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 26 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
It is in the file `package.json`
-->

## [0.3.10] - 2020-01-20

- Add support for Ampersand 4.0. This release of ampersand has a new command line interface. The plugin now
automatically detects the version you use. The daemon is launched using the correct command.
- Support for (deprecated!!) `PATTERN`/`ENDPATTERN`, `PROCESS`/`ENDPROCESS`, and `SERVICE`/`ENDSERVICE` syntax reinstated

## [0.3.9] - 2019-08-23

- Fix launching on MacOS
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "language-ampersand",
"displayName": "Ampersand (ADL) language support",
"version": "0.3.9",
"version": "0.3.10",
"publisher": "AmpersandTarski",
"description": "Language support for Ampersand scripts",
"categories": [
Expand Down
18 changes: 11 additions & 7 deletions snippets/ampersand.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,17 @@
"description": "propbutton arguments",
"body":[
"cRud BOX <PROPBUTTON>",
" [ label: TXT \"${1:buttontext}\" -- text to show on the button",
" , property: ${2:propertyrelation} cRUd -- relation of type [PROP] whose value is toggled when user presses button",
" , color: TXT \"${3|primary,secondary,success,warning,danger,info,light,dark,link|}\" -- primary=blue secondary=grey, success=green, warning=yellow, danger=red, info=lightblue, light=grey, dark=black",
" , disabledcolor: TXT \"${4|primary,secondary,success,warning,danger,info,light,dark,link|}\" -- precede color with `outline-` (e.g. `outline-primary`) to make an outline-button",
" , disabled: ${5:propertyExpression} cRud -- when [PROP]-type expression is not empty, button is disabled (user cannot click it)",
" , hide: ${6:propertyExpression} cRud -- when [PROP]-type expression is not empty, button does not show on screen",
" , popovertext: TXT \"${7:hovertext}\" -- text that shows when user hovers cursor over the button",
" [ label: TXT \"${1:buttontext}\" -- text to show on the button (label text)",
" , label1: TXT \"${2:buttontext}\" -- label text = label+label1",
" , label2: TXT \"${3:buttontext}\" -- label text = label+label1+label2",
" , label3: TXT \"${4:buttontext}\" -- label text = label+label1+label2+label3",
" , property: ${5:propertyrelation} cRUd -- relation of type [PROP] whose value is toggled when user presses button",
" , color: TXT \"${6|primary,secondary,success,warning,danger,info,light,dark,link|}\" -- primary=blue secondary=grey, success=green, warning=yellow, danger=red, info=lightblue, light=grey, dark=black",
" , disabledcolor: TXT \"${7|primary,secondary,success,warning,danger,info,light,dark,link|}\" -- precede color with `outline-` (e.g. `outline-primary`) to make an outline-button",
" , disabled: ${8:propertyExpression} cRud -- when [PROP]-type expression is not empty, button is disabled (user cannot click it)",
" , hide: ${9:propertyExpression} cRud -- when [PROP]-type expression is not empty, button does not show on screen",
" , disabledpopovertext: TXT \"${11:disabledhovertext}\" -- text that shows when user hovers cursor over the button when it is disabled",
" , popovertext: TXT \"${10:hovertext}\" -- text that shows when user hovers cursor over the button",
" ]"
]
},
Expand Down
27 changes: 24 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,20 @@ export function activate(context: vscode.ExtensionContext) {
let file = path.join(os.tmpdir(), "ampersandDaemon-" + hash + ".txt");
context.subscriptions.push({dispose: () => {try {fs.unlinkSync(file);} catch (e) {};}});
fs.writeFileSync(file, "");

let versionString : string = getVersion();
let runAmpersandCommand : string = "ampersand";
let runAmpersandArgs : string = "--daemon";
var runAmpersandArgs : string = "";
let version : string = versionString.substr(10,3)
if (version === "v4.") {
runAmpersandArgs = "daemon"
} else if (version === "v3.") {
runAmpersandArgs = "--daemon"
} else {
vscode.window.showErrorMessage
('The version of ampersand you have installed, is not supported: '+versionString)

}

let opts : vscode.TerminalOptions =
os.type().startsWith("Windows") ?
{shellPath: "cmd.exe", shellArgs: ["/k", runAmpersandCommand , runAmpersandArgs]} :
Expand All @@ -178,6 +189,16 @@ export function activate(context: vscode.ExtensionContext) {

}

function getVersion() : string {
const { execSync } = require('child_process');
// stderr is sent to stderr of parent process
// you can set options.stdio if you want it to go elsewhere
let command = `${constants.extension.generatorName} --version`;
let version = execSync(command);
var string = new TextDecoder("utf-8").decode(version);
return string

}


function checkVersion () {
Expand All @@ -196,7 +217,7 @@ function checkVersion () {
return " " + b
}
}
let r1 = /Ampersand-(v[0-9]+\.[0-9]+\.[0-9]+) \[(.*)?\],/ ;
let r1 = /Ampersand-(v[0-9]+\.[0-9]+\.[0-9]+) \[(.*)?\]/ ;
var m : RegExpMatchArray | null ;
var result : string | null = null ;
if (m = xs.match(r1)) {
Expand Down
33 changes: 22 additions & 11 deletions syntaxes/ampersand.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
[ { "comment": "to be reviewed using https://www.sublimetext.com/docs/3/scope_naming.html"},
{ "include": "#COMMENTS" },
{ "include": "#CONTEXT" },
{ "include": "#ENDPATTERN" },
{ "include": "#META" },
{ "include": "#PURPOSE" },
{ "include": "#INCLUDE" },
{ "include": "#CONCEPT" },
{ "include": "#CLASSIFY" },
{ "include": "#REPRESENT" },
{ "include": "#IDENT" },
{ "include": "#REPRESENT" },
{ "include": "#IDENT" },
{ "include": "#RELATION" },
{ "include": "#MSGMEANING" },
{ "include": "#PRAGMA" },
Expand Down Expand Up @@ -103,7 +104,7 @@

"CONTEXT":
{ "patterns":
[ { "match": "\\b(CONTEXT)\\s+(\")?([^\"]*)(\\2)?(\\s+IN\\s+(DUTCH|ENGLISH))?",
[ { "match": "\\b(CONTEXT|PATTERN|PROCESS)\\s+(\")?([^\"]*)(\\2)?(\\s+IN\\s+(DUTCH|ENGLISH))?",
"captures": {
"0": { "name":"meta.context.ampersand"},
"1": { "name":"keyword.operator.context.ampersand"},
Expand All @@ -117,6 +118,16 @@
]
},

"ENDPATTERN":
{ "patterns":
[ { "match": "\\b(ENDPATTERN|ENDPROCESS)\\b",
"captures": {
"1": { "name":"keyword.operator.context.language.ampersand"}
}
}
]
},

"META":
{ "patterns":
[ { "match": "\\b(META)\\s+(\")([^\"]*)(\")\\s+(\")([^\"]*)(\")",
Expand Down Expand Up @@ -182,7 +193,7 @@
},
{ "comment":"PURPOSE <keyword> \"<identifier>\" -- tnx to https://github.com/Microsoft/vscode-textmate/issues/41",
"name": "meta.purpose.ampersand",
"begin": "\\b(PURPOSE)\\s+(CONTEXT|CONCEPT|RELATION|RULE|INTERFACE|API|GUI)\\s+(?:(\\w+)|(\")([^\"]+)(\"))(?:\\s*(IN)\\s+(DUTCH|ENGLISH))?(?:\\s+(REF)\\s+(\")([^\"]*)(\"))?",
"begin": "\\b(PURPOSE)\\s+(CONTEXT|PATTERN|PROCESS|CONCEPT|RELATION|RULE|INTERFACE|API|GUI)\\s+(?:(\\w+)|(\")([^\"]+)(\"))(?:\\s*(IN)\\s+(DUTCH|ENGLISH))?(?:\\s+(REF)\\s+(\")([^\"]*)(\"))?",
"beginCaptures": {
"0": { "name":"meta.purpose.begin.ampersand"},
"1": { "name":"keyword.operator.purpose.ampersand"},
Expand Down Expand Up @@ -307,23 +318,23 @@
},
{ "comment": "CLASSIFY <Conceptlist> IS <Concept1> /\\ <Concept2> ...",
"name": "meta.classify.is.ampersand",
"begin": "\\b(CLASSIFY)\\s+(?:([A-Z]\\w*)|(\")([A-Z][^\"]*)(\"))(?:\\s*(,)\\s*(?:([A-Z]\\w*)|(\")([A-Z][^\"]*)(\")))*\\s+(IS)\\s+(?:([A-Z]\\w*)|(\")([A-Z][^\"]*)(\"))",
"begin": "\\b(CLASSIFY)\\s(?:\\s*(?:([A-Z]\\w*)|(\")([A-Z][^\"]*)(\"))\\s*(,))*(?:\\s*(?:([A-Z]\\w*)|(\")([A-Z][^\"]*)(\")))\\s+(IS)\\s+(?:([A-Z]\\w*)|(\")([A-Z][^\"]*)(\"))",
"beginCaptures": {
"0": { "name":"meta.classify.is.begin.ampersand"},
"1": { "name":"keyword.operator.classify.ampersand"},
"2": { "name":"variable.concept.ampersand"},
"2": { "name":"variable.unquoted.concept.ampersand"},
"3": { "name":"punctuation.statement.classify.ampersand"},
"4": { "name":"variable.concept.ampersand"},
"4": { "name":"variable.quoted.concept.ampersand"},
"5": { "name":"punctuation.statement.classify.ampersand"},
"6": { "name":"punctuation.statement.classify.ampersand"},
"7": { "name":"variable.concept.ampersand"},
"7": { "name":"variable.unquoted.concept.ampersand"},
"8": { "name":"punctuation.statement.classify.ampersand"},
"9": { "name":"variable.concept.ampersand"},
"9": { "name":"variable.quoted.concept.ampersand"},
"10": { "name":"punctuation.statement.classify.ampersand"},
"11": { "name":"keyword.operator.classify.ampersand"},
"12": { "name":"variable.concept.ampersand"},
"12": { "name":"variable.unquoted.concept.ampersand"},
"13": { "name":"punctuation.statement.classify.ampersand"},
"14": { "name":"variable.concept.ampersand"},
"14": { "name":"variable.quoted.concept.ampersand"},
"15": { "name":"punctuation.statement.classify.ampersand"}
},
"end": "^(?=\\s*([^A-Z/]|VIOLATION|ROLE|SERVICE|RULE|INCLUDE|CONCEPT|CLASSIFY|REPRESENT|IDENT|RELATION|[a-z]\\w*\\s*::|POPULATION|INTERFACE|VIEW|MEANING|MESSAGE|PRAGMA))",
Expand Down

0 comments on commit ca66e78

Please sign in to comment.