diff --git a/client/CHANGELOG.md b/client/CHANGELOG.md index ab3bf32..dc92ca2 100644 --- a/client/CHANGELOG.md +++ b/client/CHANGELOG.md @@ -1,11 +1,22 @@ # Change Log All notable changes to the "Harbour and xHarbour" extension will be documented in this file. -# 0.9.11 +# 0.9.12 - **debugger** better stability - **task** better stability - **task** correct management of batch option +# 0.9.11 + - **server** fixes case of unfound parent [#57](https://github.com/APerricone/harbourCodeExtension/issues/57) + - **syntax** fixes [memvar aliasing syntax highlighting #58](https://github.com/APerricone/harbourCodeExtension/issues/58), + [Multiline "inline" class methods syntax highlighting #59](https://github.com/APerricone/harbourCodeExtension/issues/59), + [Try catch syntax highlighting #60](https://github.com/APerricone/harbourCodeExtension/issues/60) by [Edgard Lorraine Messias](https://github.com/edgardmessias) + - **debugger** better step out and step next support + - **server** better code folding see [#56](https://github.com/APerricone/harbourCodeExtension/issues/56) + - **task** added temporary variable solver waiting for [VSCode #81007](https://github.com/microsoft/vscode/issues/81007) + + Many thanks to [Seth Hovestol](https://github.com/Hovestar) for bug reportinh + # 0.9.10 - **debugger** added process list on attach, attach by process Id - **task** added Harbour and HBMK2 tasks, BETA @@ -63,13 +74,13 @@ All notable changes to the "Harbour and xHarbour" extension will be documented i # 0.9.0 - **server** add hover for defines - - **syntax** a lot of fixes by [Edgard Lorraine Messias](mailto:edgardmessias@gmail.com) + - **syntax** a lot of fixes by [Edgard Lorraine Messias](https://github.com/edgardmessias) - **server** added information about class during completition # 0.8.12 - **debugger** Added options for error management - **server** Fix some crash - - **syntax** use of [Edgard Lorraine Messias](mailto:edgardmessias@gmail.com) syntax + - **syntax** use of [Edgard Lorraine Messias](https://github.com/edgardmessias) syntax - **server** Fixed deletion of wrong fields # 0.8.10 - 0.8.11 diff --git a/client/README.md b/client/README.md index 86216e8..18c12ca 100644 --- a/client/README.md +++ b/client/README.md @@ -9,7 +9,7 @@ do you like this extension? Help me to make it better with a donation, click the ## Features -- [syntax hightlight](https://github.com/APerricone/harbourCodeExtension/wiki/Syntax-hightlight), with [Edgard Lorraine Messias](mailto:edgardmessias@gmail.com) +- [syntax hightlight](https://github.com/APerricone/harbourCodeExtension/wiki/Syntax-hightlight), with [Edgard Lorraine Messias](https://github.com/edgardmessias) - [Debug support](https://github.com/APerricone/harbourCodeExtension/wiki/Debugger) - [Diagnostic infos](https://github.com/APerricone/harbourCodeExtension/wiki/Diagnostics-Lint) - Symbol Definitions Within a Document provider (access it by pressing CTRL+SHIFT+O or CTRL+P then @) diff --git a/client/package.json b/client/package.json index 4ecfbab..d1eac61 100644 --- a/client/package.json +++ b/client/package.json @@ -2,7 +2,7 @@ "name": "harbour", "displayName": "Harbour and xHarbour", "description": "Harbour and xHarbour languages support for visual studio code", - "version": "0.9.11", + "version": "0.9.12", "publisher": "aperricone", "icon": "harbourIcon.png", "main": "./dist/extension", diff --git a/client/syntaxes/harbour.tmLanguage.json b/client/syntaxes/harbour.tmLanguage.json index a3c9913..18902aa 100644 --- a/client/syntaxes/harbour.tmLanguage.json +++ b/client/syntaxes/harbour.tmLanguage.json @@ -367,7 +367,7 @@ }, "variable-memvar-declaration": { "name": "meta.definition.variable.memvar.harbour", - "begin": "(?i)^\\s*memv(?:a(?:r)?)?\\b", + "begin": "(?i)^\\s*memv(?:a(?:r)?)?\\b(?!->)", "beginCaptures": { "0": { "name": "storage.type.memvar.harbour" @@ -390,19 +390,33 @@ ] }, "variable-field-declaration": { - "match": "(?i)^\\s*(_?field?)\\s*(->)\\s*([a-z0-9_]+)", - "captures": { - "1": { + "name": "meta.definition.variable.memvar.harbour", + "begin": "(?i)^\\s*_?field?\\b(?!->)", + "beginCaptures": { + "0": { "name": "storage.type.field.harbour" + } + }, + "end": "(?m:$)", + "patterns": [{ + "include": "#continue-expression" }, - "2": { - "name": "keyword.accessor.harbour" + { + "include": "#comments" }, - "3": { - "name": "meta.definition.variable.field.harbour" + { + "name": "keyword.in.harbour", + "match": "(?i)\\bIN\\b" + }, + { + "name": "variable.other.readwrite.field.harbour", + "match": "(?i)\\b([A-Z_]\\w*)\\b" + }, + { + "include": "#punctuation-comma" } - } - }, + ] + }, "variable-local-declaration": { "name": "meta.definition.variable.local.harbour", "begin": "(?i)^\\s*(loca(?:l)?)\\b", @@ -616,20 +630,26 @@ } ] }, + { + "include": "#inline-method-declaration" + }, { "include": "#method-declaration" }, { - "match": "^\\s*(export(?:ed)?|visible|hidden|protected):", + "match": "(?i)^\\s*(export(?:ed)?|visible|hidden|private|protected)(:)", "captures": { "1": { "name": "storage.modifier.harbour" + }, + "2": { + "name": "punctuation.separator.colon.harbour" } } }, { "name": "meta.field.declaration.harbour", - "begin": "(?i)^\\s*(?:class)?(data|var)\\b", + "begin": "(?i)^\\s*(?:class)?(data|var|access)\\b", "beginCaptures": { "0": { "name": "storage.type.field.harbour" @@ -658,7 +678,7 @@ } }, { - "begin": "(?i)(assign|init)\\s+", + "begin": "(?i)(assign|init|inline)\\s+", "beginCaptures": { "1": { "name": "keyword.control.${1:/downcase}.harbour" @@ -684,13 +704,43 @@ ] }] }, + "inline-method-declaration": { + "patterns": [{ + "name": "meta.inline-method.declaration.harbour", + "begin": "(?i)^\\s*(inline)\\s*(method)\\b", + "beginCaptures": { + "1": { + "name": "constant.language.inline.harbour" + }, + "2": { + "name": "keyword.type.method.harbour" + } + }, + "end": "(?i)END[\\t ]*METHOD", + "endCaptures": { + "0": { + "name": "keyword.end.class.harbour" + } + }, + "patterns": [{ + "include": "#continue-expression" + }, + { + "include": "#comments" + }, + { + "include": "#function-staments" + } + ] + }] + }, "method-declaration": { "patterns": [{ "name": "meta.method.declaration.harbour", - "begin": "(?i)^\\s*(method)\\b", + "begin": "(?i)^\\s*(assign|method)\\b", "beginCaptures": { "1": { - "name": "keyword.type.method.harbour" + "name": "keyword.type.${1:/downcase}.harbour" } }, "end": "(?m:$)", @@ -948,23 +998,55 @@ }] }, "macro-var": { - "patterns": [{ - "name": "meta.macro-var.harbour", - "match": "(?i)(&)([a-zA-Z_][a-zA-Z0-9_]*)(\\.)?", - "captures": { - "1": { - "name": "punctuation.definition.macro.begin.harbour" - }, - "3": { - "name": "punctuation.definition.macro.end.harbour" + "name": "meta.macro-var.harbour", + "begin": "(?i)(&)([a-zA-Z_][a-zA-Z0-9_]*)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.macro-var.harbour" + }, + "2": { + "name": "entity.other.attribute-name.macro.harbour" + } + }, + "end": "(?=[^.\\w])", + "patterns": [ + { + "match": "(\\.)", + "captures": { + "1": { + "name": "punctuation.accessor.harbour" + } + } + }, + { + "match": "(\\w)", + "captures": { + "1": { + "name": "variable.other.property.harbour" + } } } - }] + ] }, "macro-exp": { + "name": "meta.macro-exp.harbour", + "begin": "(?i)(&)(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.macro-exp.harbour" + }, + "2": { + "name": "punctuation.definition.begin.bracket.round.harbour" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.end.bracket.round.harbour" + } + }, "patterns": [{ - "name": "punctuation.definition.macro.harbour", - "match": "(?i)(&)(?=\\()" + "include": "#inline-staments" }] }, "keywords": { @@ -973,6 +1055,7 @@ { "name": "keyword.announce.harbour", "match": "\\b(?i:anno(?:u(?:n(?:ce?)?)?)?)\\b" }, { "name": "keyword.begin.harbour", "match": "\\b(?i:begin?\\s+sequ(?:e(?:n(?:ce?)?)?)?)\\b" }, { "name": "keyword.break.harbour", "match": "\\b(?i:break?)\\b" }, + { "name": "keyword.catch.harbour", "match": "\\b(?i:catch?)\\b" }, { "name": "keyword.case.harbour", "match": "\\b(?i:case)\\b" }, { "name": "keyword.declare.harbour", "match": "\\b(?i:decl(?:a(?:re?)?)?)\\b" }, { "name": "keyword.descend.harbour", "match": "\\b(?i:descend)\\b" }, @@ -989,6 +1072,8 @@ { "name": "keyword.end.harbour", "match": "\\b(?i:end)\\b" }, { "name": "keyword.exit.harbour", "match": "\\b(?i:exit)\\b" }, { "name": "keyword.external.harbour", "match": "\\b(?i:exte(?:r(?:n(?:al?)?)?)?)\\b" }, + { "name": "keyword.field.harbour", "match": "\\b(?i:field?)\\b" }, + { "name": "keyword.finally.harbour", "match": "\\b(?i:fina(?:l(?:ly?)?)?)\\b" }, { "name": "keyword.for.harbour", "match": "\\b(?i:for(?:\\s+each)?)\\b" }, { "name": "keyword.function.harbour", "match": "\\b(?i:func(?:t(?:i(?:on?)?)?)?)\\b" }, { "name": "keyword.if.harbour", "match": "\\b(?i:if)\\b" }, @@ -1014,6 +1099,8 @@ { "name": "keyword.switch.harbour", "match": "\\b(?i:swit(?:ch?)?)\\b" }, { "name": "keyword.thread.harbour", "match": "\\b(?i:thre(?:ad?)?)\\s+stat(?:ic?)?\\b" }, { "name": "keyword.to.harbour", "match": "\\b(?i:to)\\b" }, + { "name": "keyword.throw.harbour", "match": "\\b(?i:throw?)\\b" }, + { "name": "keyword.try.harbour", "match": "\\b(?i:try)\\b" }, { "name": "keyword.while.harbour", "match": "\\b(?i:while?)\\b" }, { "name": "keyword.with.harbour", "match": "\\b(?i:with\\s+obje(?:ct?)?)\\b" }, { "name": "keyword._hb_class.harbour", "match": "\\b(?i:_hb_class)\\b" }, @@ -1037,7 +1124,15 @@ }, { "name": "keyword.accessor.harbour", - "match": "->" + "match": "(->)(\\w+)?", + "captures": { + "1": { + "name": "keyword.accessor.harbour" + }, + "2": { + "name": "variable.other.property.harbour" + } + } }, { "name": "keyword.operator.logical.harbour", diff --git a/server/package.json b/server/package.json index b80464a..9380f8f 100644 --- a/server/package.json +++ b/server/package.json @@ -4,6 +4,9 @@ "version": "0.5.0", "author": "aperricone", "main": "dist/hb_server.js", + "bin": { + "hbLanguageServer": "dist/hb_server.js" + }, "license": "GPL", "repository": { "url": "https://github.com/APerricone/harbourCodeExtension" diff --git a/server/src/main.js b/server/src/main.js index bb747de..ed5d216 100644 --- a/server/src/main.js +++ b/server/src/main.js @@ -325,10 +325,11 @@ function kindTOVS(kind, sk) { return sk ? server.SymbolKind.Method : server.CompletionItemKind.Method; case "data": return sk ? server.SymbolKind.Property : server.CompletionItemKind.Property; - case "function": - case "procedure": case "function*": case "procedure*": + return sk ? server.SymbolKind.Interface : server.CompletionItemKind.Interface; + case "function": + case "procedure": case "C-FUNC": return sk ? server.SymbolKind.Function : server.CompletionItemKind.Function; case "local": @@ -372,7 +373,13 @@ connection.onDocumentSymbol((param) => { var names = []; while (pp) { if (pp.kind == "method" && pp.foundLike == "definition" && (!pp.parent || pp.startLine > pp.parent.endLine)) { - names.push(pp.parent.name + ":" + pp.name); + if(pp.parent) + names.push(pp.parent.name + ":" + pp.name); + + else if(pp.parentName) + names.push(pp.parentName+"???:" + pp.name); + else + names.push("???:" + pp.name); break; } else names.push(pp.name); @@ -389,9 +396,14 @@ connection.onDocumentSymbol((param) => { } } } else - if (info.kind == "method" && info.parent) - docSym.name = info.parent.name + ":" + info.name - + if (info.kind == "method") { + if(info.parent) + docSym.name = info.parent.name + ":" + info.name + else if(info.parentName) + docSym.name = info.parentName+"???:" + info.name; + else + docSym.name = "???:" + info.name; + } parent.push(docSym); //} }; diff --git a/server/src/provider.js b/server/src/provider.js index beb41dc..26207d4 100644 --- a/server/src/provider.js +++ b/server/src/provider.js @@ -136,7 +136,11 @@ function Info(name, kind, foundLike, parent, document, startLine, startCol, endL /** @type {string} */ this.foundLike = foundLike; /** @type {Info} */ - this.parent = parent; + if(typeof(parent)=="string") { + this.parentName = parent; + this.parent = undefined; + } else + this.parent = parent; /** @type {string} */ this.document = document; /** @type {number} */ @@ -637,7 +641,7 @@ Provider.prototype.parseHarbour = function (words) { } if (r[5] && r[5].length) fLike = "definition"; if (this.currentMethod) this.currentMethod.endLine = this.lastCodeLine; - this.currentMethod = this.addInfo(r[2], 'method', fLike, this.currentClass); + this.currentMethod = this.addInfo(r[2], 'method', fLike, this.currentClass || r[4]); if (r[3] && r[3].length) this.parseDeclareList(r[3], "param", this.currentMethod); diff --git a/test/.vscode/settings.json b/test/.vscode/settings.json index 5286b1f..dc454f8 100644 --- a/test/.vscode/settings.json +++ b/test/.vscode/settings.json @@ -12,6 +12,6 @@ "terminal.integrated.shell.windows": "cmd.exe", "terminal.integrated.shellArgs.windows": [ "/k", - "c:\\harbour32\\start.bat" + "c:\\harbour\\start64.bat" ] } \ No newline at end of file diff --git a/test/.vscode/tasks.json b/test/.vscode/tasks.json index 4c36c59..87a98ea 100644 --- a/test/.vscode/tasks.json +++ b/test/.vscode/tasks.json @@ -52,7 +52,10 @@ "HB_INSTALL_PREFIX": "C:\\harbour" } }, - "setupBatch": "c:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars32.bat", + "window": + { + "setupBatch": "c:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars32.bat" + }, "extraArgs": ["-w3", "-es2", "-ocode_dbg","-gc3", "-hblib","-inc","-winuni"] }, { diff --git a/test/dbg_test.prg b/test/dbg_test.prg index c5c4503..4459a99 100644 --- a/test/dbg_test.prg +++ b/test/dbg_test.prg @@ -67,7 +67,7 @@ proc main( ) j:=i*2 ? "i vale &( str(i) ), j vale &(j), formula &(i*2)" next - //AltD() + AltD() ? "Perry" //begin sequence with {|| QOut("eh") } // eval(&bs,"",c)