jonnyboyC / kos-language-server

A language server for the Kerboscript (kOS) a language for Kerbal Space Program
MIT License
25 stars 6 forks source link

[BUG] VSCode: Cannot use multiple #region directives #159

Closed w3bward closed 4 years ago

w3bward commented 4 years ago

Describe the bug When using the #region and #endregion directives in Visual Studio Code, the first #region folds to the last #endregion, custom regions defined with the region/endregion directives between the first and last region/endregion directives are not collapsible.

For kicks, I decided to see what would happen if I stuck an orphaned //#endregion at some point after a defined region, and to my surprise it did not fold to the orphaned //#endregion without an accompanying //#region (see Examples 2 & 3).

To Reproduce Steps to reproduce the behavior:

  1. Surround a block of code in //#region and //#endregion
  2. At some point after the //#endregion, surround another block of code in //#region and //#endregion
  3. Fold the code at the first //#region

Example 1:

//#region   <------------------ Folding here...
<Some kerboscript>
//#endregion

<Some more kerboscript>

//#region <-------------------- VSCode does not provide an option to fold here
<And still more kerboscript>
//#endregion  <--------------- Collapses to here.

Example 2:

//#region   <------------------ Folding here...
<Some kerboscript>
//#endregion

<Some more kerboscript>

//#region <------------------- VSCode does not provide an option to fold here
<And still more kerboscript>
//#endregion  <-------------- Collapses to here...

<Moar kerboscript!!!>

//#endregion <---------------Surprisingly, it did not fold to here

Example 3:

//#region   <------------------ Folding here...
<Some kerboscript>
//#endregion

<Some more kerboscript>

//#region <------------------- VSCode does not provide an option to fold here
<And still more kerboscript>
//#endregion

<Moar kerboscript!!!>

//#region
//#endregion <-------------- Now it collapses to here

Expected behavior A region directive should fold to the next endregion directive, and multiple directive defined regions within a script should be functional

Editor (please complete the following information):

jonnyboyC commented 4 years ago

Thanks for the report and the great examples! I'm sure this will be a relatively simple fix. I'll post back here when I have an updated version ready to be deployed.

jonnyboyC commented 4 years ago

Version 1.1.4 is now live on the marketplace and should resolve the reported issue. Feel free to reopen this issue if that is not the case for you locally.

w3bward commented 4 years ago

It looks like that fixed it. Thank you for the incredibly quick support!