PG snippets issue

Hi @Tricotou !

The issue still persists. Could you have a look at it please?

3 Likes

My day is starting like this again :frowning:

Could we somehow solve this issue?

Cc @Tricotou if he is around

Hello guys,
I just came back from vacation :slight_smile:
Iā€™ll have a look to this within the next days :+1:

3 Likes

Save me! :joy::joy:

I still canā€™t give you a precise description when this occurs but in 80% it was when I deleted the line with the FreeCamera and just right after that I tried to insert the ARC using the snippet shortcut.

I am sure itā€™s related to the message in the console I already reported.

@roland do you have a way to pull and test a branch on the machine you are having the issue on ?
Since I cannot reproduce, I cannot really test any new version of the codeā€¦

Sure :sunglasses:

Just right nowā€¦ :angry: :frowning:

Ah ! I was about to reach you again about this :slight_smile:
A few questions :

  • On the machine you can reproduce the problem on, how exactly is it ā€œrandomā€ ?

      1. Not random. All the time
      1. Sometimes, when adding a snippet. But if I erase and add again itā€™s OK
      1. Sometimes the whole PG does this on any snippet add. But after page reload itā€™s OK for all snippets.
      1. Otherā€¦ ?
  • Also, the message ā€œNo codicon found for CompletionItemKind undefinedā€ do you have it ONLY when having as well the issue ?

I didnā€™t discover any pattern when it fails. This morningā€™s case was like this: I opened an existing PG, put the cursor a on the line above the freecamera. Tried ot insert the snipped and it has failed.
Iā€™ve opened a new PG in a new Tab. If failed again. I tried to open one more PG and it has worked.

Correct.

@roland , ok so still I canā€™t reproduce your MacOS issue, but here is my try :

  • Previously (before adding my new snippet menu) the JSON for snippets was like this (in term of structure) :
{
    "label": "Scene : Setup a shadow generator",
    "key": "Shadows",
    "documentation": "https://doc.babylonjs.com/features/featuresDeepDive/lights/shadows",
    "insertText": "var shadowGenerator = new BABYLON.ShadowGenerator(${1:1024}, ${2:light});\nshadowGenerator.useExponentialShadowMap = true;"
}

NB: The ${1:1024}, ${2:light}, is proper to Monaco editor, setting the first TAB to 1024, second TAB to light, etc, etcā€¦ Then itā€™s automatically loaded from this._templates in the MonacoManager class

  • Then when I added the menu with submenus (visual way of inserting snippets) since it was no longer handled by Monaco itself, but by me, I had added a new key to this._templates, which was ā€œplainTextā€, I.E. the same code without the dollar stuff (${1:1024} ā†’ 1024)
  • I suspect that this new ā€œunknownā€ key is messing up the Monaco editor, resulting in your error + weird text insertion
  • As a fix, I removed this plainText key, and replaced by a new function to go from the insertText (with dollar stuff) to plainText, using a regex rule.

May I suggest you to give a try to this fix ?

++
Tricotou

1 Like

This will be the first thing Iā€™ll do when I turn on my computer on Saturday, right after I come back from my vacation.

Thank you!

1 Like

I canā€™t believe this is happening!! :crazy_face: :crazy_face: :crazy_face: :metal:

I tried everything to get incorrect injected code but no success :supervillain: (this is a supervillain emoji btw)

Even the tabs are working as expected:

Iā€™ll play with it for a bit longer but Iā€™m already convinced you killed that nasty :bug:

1 Like

Doesnā€™t look very frightening :joy: This emoji would need a design update :rofl: :imp: :scream: :fearful:

1 Like

No issues after a few hours of testing. Thanks!

Nice ! Then letā€™s PR this branch and problem will be officially gone :stuck_out_tongue:

Thanks for testing :slight_smile:

Here we are :

3 Likes