BBx-Kitchen / bbj-language-server

BBj Language Server
MIT License
7 stars 6 forks source link

REM : line and block comments shortcuts are not working in vscode #73

Closed hyyan closed 1 year ago

hyyan commented 1 year ago

https://github.com/BBx-Kitchen/bbj-language-server/assets/4313420/c9e3f1a0-03ec-4281-8258-117dc82bbd60

dhuebner commented 1 year ago

@hyyan Block comments are not supported in BBx because a block comment need a start and end char sequence. I will enable single line comments for now.

hyyan commented 1 year ago

Block comments are not supported in BBx because a block comment need a start and end char sequence

BBx part is understood. The starting sequence is rem /** and the end one is rem */

dhuebner commented 1 year ago

@hyyan Will following code be accepted as multiline comment in your runtime?

rem /**
Here is a
multiline comment
rem */
hyyan commented 1 year ago

@hyyan Will following code be accepted as multiline comment in your runtime?

rem /**
Here is a
multiline comment
rem */

No. comment lines should start with REM. The block comment is tricky and requires defining onEnterRules

dhuebner commented 1 year ago

@hyyan

The starting sequence is rem /* and the end one is rem /

Then this will not work as a multiline comment in vs-code.

dhuebner commented 1 year ago

@hyyan Maybe we could add a code snippet for that. What do you think?

rem /**
rem *
rem */
hyyan commented 1 year ago

@dhuebner We have that working in Eclipse and we got it working in vscode before by using something like that. Even though it is not 100% optimal. Maybe we can use that as a start and improve it ?

{
  "comments": {
    "lineComment": "rem",
    "blockComment": [
      "rem /**",
      "rem  */"
    ]
  },
  "onEnterRules": [
    {
      "beforeText": "^\\s*rem\\s*\\/\\*\\*(?!\\/)([^\\*]|\\*(?!\\/))*$",
      "action": {
        "indent": "indentOutdent",
        "appendText": "rem  *  "
      }
    },
    {
      "beforeText": "^\\s*rem\\s*\\*[^\\/].*$",
      "action": {
        "indent": "none",
        "appendText": "rem  *  "
      }
    },
    {
      "beforeText": "^\\s*rem[^\\*]$",
      "action": {
        "indent": "none",
        "appendText": "rem "
      }
    }
  ]
}
dhuebner commented 1 year ago

@hyyan Sure! Would you like to open a PR? Here is the config file: https://github.com/BBx-Kitchen/bbj-language-server/blob/main/bbj-vscode/language-configuration.json

hyyan commented 1 year ago

@dhuebner I'll prepare one