michaelangeloio / does-it-throw

lsp server for finding ES statements that throw!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functions and throw statements are underlined even if caught

thedevbirb opened this issue · comments

Description of the issue

As title says, even if a function has a single throw statement that is properly catched, the plugin underlines both the throw statement and the function. Calls to such function results in hints provided by the plugin too.

This can lead a lot of verbose LSP hints even in a relatively small codebase.

Example of the issue

Consider this simple code snippet:

function A() {
  try {
    throw new Error();
  } catch {}
}

function B() {
    A();
}

Here is how the LSP handles such code:
image

Expected/Desired behaviour

Given that the function A in the example does not have uncaught errors, I'd expect to not receive any LSP hint at all.

System information

If needed, here are my machine specs:

Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:47:11.635Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.6.6-100.fc38.x86_64

@lorenzofero done! Please re-open if you find any edge cases!!