phil294 / coffeesense

IntelliSense for CoffeeScript. LSP implementation / VSCode extension
MIT License
47 stars 8 forks source link

Semicolon added after period in documentation text #11

Closed STRd6 closed 2 years ago

STRd6 commented 2 years ago
#
###*
.
###
attach = "a"
/**
.;
*/

let attach = "a";

A semicolon is added after the last period in a comment's line of text. This scuffs up the tooltip docs when hovering the documented symbol in another location.

phil294 commented 2 years ago

yeah that's unfortunate :/ a workaround is to prefix the . with a #. I'll fix it some day

phil294 commented 2 years ago

For even greater nonsense, add a space instead of the dot and hover...

Anyway, I'm not really sure how to fix this. The ; insertion is one of the many transforms to bypass compilation errors while typing. It only gets omitted if any # in a previous position in that line could be found. This is already wacky because a number sign can also appear in different contexts, such as strings. That's just due to the nature of the extension which merely applies regexes.

But this begs the question, why is this an issue after all? When do you type lone dots in comment blocks? I can only think of two cases, the first being textual content

###*
wow, what a great variable.
###
my_var = 1

will show wow, what a great variable.;

and the other one being typos/ syntax errors in JSDoc:

###*
@type {
    x: X.
}
###
x: X

which doesn't change much really

both of which are somewhat forgivable. And if it's really too bad, do

###*
# wow, what a great variable.
###
my_var = 1

So unless I'm missing something, I guess this is a wontfix. Thanks for the report!

STRd6 commented 2 years ago

Thanks for the response, I can live with it.

👍