Community
Participate
Working Groups
0.3 M2 I believe this is a known limitation from JSLint, but the unused variable warning range is wrong. It should underline the variable declaration rather than the surrounding function declaration.
JSLint does not provide that. - We could write a bit of code to underline the name of function tha thas the problem (instead of te preceeding chars). (easy) - We could writea lot o code trying to find the exactly place (harder).
Underlining the function would be better. Currently it just looks floating squiggles not associated with anything. Actually, if we renamed the warning to "Function defines unused variable foo" then underlining the function name would at least be consistent with the description.
Implemented John's suggestion from Comment 2: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=8e119732eb73624787dec641484eced08c3e47cb Because JSLint doesn't give any more detail beyond line number and function name, my approach breaks down in some cases. For example, this line is annotated correctly: > var obj = { foo: function() { var unused1; function bar() { var unused2; } } }; ^^^^^^^^ ^^^^^^^^ But in this one, the name/linenumber combination is ambiguous so I end up annotating the first 'foo' for both unused variables: > var obj = { foo: function() { var unused1; function foo() { var unused2; } } }; ^^^^^^^^ This is not a big deal when editing normal code, but we will need a more robust parser to handle cases like these correctly.