@verbatim directives being inserted before @//ts-expect-error javascript directives

23 views
Skip to first unread message

Félix

unread,
Nov 28, 2021, 7:08:54 PM11/28/21
to leo-editor
(intro/context)
In javascript and typescript , popular linters accept 'comments starting with @' for the linter to intercept, and act accordingly, such as //@ts-expect-error or //@ts-ignore-error (used to ignore expected errors on the following line)

(problem)
After pulling the latest Leo sources from devel and working on the leojs typescript project, I'm getting some @verbatim directives inserted at the very beginning of some lines, ignoring indentation, in their @file trees upon loading, (or saving not sure) ... just above //@ts-xxx-xxx directives. (sometimes duplicating themselves after saving/re-loading such as:

//@verbatim
    //@verbatim
//@verbatim
    //@verbatim
//@verbatim
    //@ts-linter-blablabla
 
This seems new , I dont think I ever saw that in the last 2 weeks when I was working on the leoUndo.ts file in leojs. 

Maybe the check for //@ to distinguish from sentinels should be more 'precise' ?  (such as : my lines didnt have the "+" character after the "@" so they should not be mistaken with sentinels, at least not easily , if my understanding of sentinels's beginning caracters are supposed to be... 

See screenshot below for exact view of the problem (I made sure to be in Leo instead of leoInteg just to be sure) There's a //@verbatim without any indentation that appeared today! hehehe... 
Screenshot from 2021-11-28 19-01-17.png
Feels like a bug... Not sure if it is.. Thanks for clearing this little thing up for my understanding ! 
--
Félix 

Félix

unread,
Nov 28, 2021, 7:28:28 PM11/28/21
to leo-editor
note : my workaround for now is to put a space between the comments symbols and the @ which also works...

like so : // @ts-expect-error 

this seems to not trigger the addition of @verbatim directives by Leo.
--
Félix

Edward K. Ream

unread,
Nov 29, 2021, 4:49:44 AM11/29/21
to leo-editor
On Sun, Nov 28, 2021 at 6:09 PM Félix <felix...@gmail.com> wrote:
(intro/context)
In javascript and typescript , popular linters accept 'comments starting with @' for the linter to intercept, and act accordingly, such as //@ts-expect-error or //@ts-ignore-error (used to ignore expected errors on the following line)

(problem)
After pulling the latest Leo sources from devel and working on the leojs typescript project, I'm getting some @verbatim directives inserted at the very beginning of some lines, ignoring indentation, in their @file trees upon loading,
 
(or saving not sure) ... just above //@ts-xxx-xxx directives.

Let me look into this.

Edward

Edward K. Ream

unread,
Nov 29, 2021, 4:50:49 AM11/29/21
to leo-editor
On Sun, Nov 28, 2021 at 6:28 PM Félix <felix...@gmail.com> wrote:
note : my workaround for now is to put a space between the comments symbols and the @ which also works...

like so : // @ts-expect-error 

this seems to not trigger the addition of @verbatim directives by Leo.

That's correct.  Leo only "escapes" lines that start with (comment delim)@, without any space.

Edward

Félix

unread,
Dec 3, 2021, 7:53:30 PM12/3/21
to leo-editor
Thanks, I'll use the workaround with the space for now on... 

My main concern was that I had a chain of 5-6 @verbatim inserted in my file as if it triggered itself. (upon writing or loading - not sure)
such as : 

//@verbatim
    //@verbatim
//@verbatim
    //@verbatim
//@verbatim
    //@ts-linter-blablabla

--
Félix
Reply all
Reply to author
Forward
0 new messages