microsoft / microsoft/TypeScript-Sublime-Plugin
Diagnostics for an empty region does not show up
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 236
- Avg merge
- 21d 13h
- Merged PRs (30d)
- 1
Description
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:


Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in typescript/listeners/idle.py around IdleListener's region construction and reproduce the issue with semicolon or trailing-comma diagnostics at line ends and whitespace-only regions. Compare the existing workaround with SublimeLinter's gutter behavior; done means empty or whitespace-only diagnostics are visible and their messages can be opened in Sublime.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100