microsoft / microsoft/TypeScript-Sublime-Plugin
Diagnostics for an empty region does not show up
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 1.7k
- Fork
- 236
- Merge medio
- 21g 13h
- PR unite (30g)
- 1
Descrizione
I'm using tslint-language-service, and it works fine except for rules like semicolon or trailing-comma. The diagnostics produced by these rules correctly end up in Sublime, but they don't get rendered because they appear inside an empty region at the end of the line and Sublime refuses to render them:

I've added a quick workaround, like this:
diff --git typescript/listeners/idle.py typescript/listeners/idle.py
index f48df56..30e6a8f 100644
--- typescript/listeners/idle.py
+++ typescript/listeners/idle.py
@@ -146,6 +146,9 @@ class IdleListener:
# character instead so user can still see the highlight.
if start == view.size() and start == end:
region = last_visible_character_region(view)
+ elif start == view.line(start).end() and start == end:
+ end = view.text_point(start_line + 1, 0)
+ region = sublime.Region(start, end)
else:
region = sublime.Region(start, end)
which seems to at least put a small red squiggle at the end of the line:

but hovering over it to get the message doesn't work. It also seems that the issue is more general, in that any region that only contains whitespace does not show up, e.g. when I add some trailing spaces:

so while this is a conservative change that solves this specific issue with semicolon and trailing-comma, I'm not sure this is the right solution in the general case. SublimeLinter adds a gutter mark for empty regions, so maybe that's a viable solution?
For reference, this behaves properly in VSCode:


Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in typescript/listeners/idle.py, intorno alla costruzione delle regioni di IdleListener, e riproduci il problema con le segnalazioni relative a punti e virgola o virgole finali alla fine delle righe e con regioni composte solo da spazi bianchi. Confronta la soluzione alternativa esistente con il comportamento della gutter di SublimeLinter; il lavoro è completo quando le segnalazioni vuote o composte solo da spazi bianchi sono visibili e i relativi messaggi possono essere aperti in Sublime.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python, typescript
- Ambito
- developer-experience, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100