Skip to content

Commit

Permalink
feat(service): fade out unused
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Dec 28, 2024
1 parent 009f4e4 commit fa4998c
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 15 deletions.
3 changes: 2 additions & 1 deletion crates/service/src/checker/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
InternUri, LanguageService, LintLevel,
};
use line_index::LineIndex;
use lsp_types::{Diagnostic, DiagnosticSeverity, NumberOrString};
use lsp_types::{Diagnostic, DiagnosticSeverity, DiagnosticTag, NumberOrString};
use rowan::ast::support;
use wat_syntax::{SyntaxKind, SyntaxNode};

Expand Down Expand Up @@ -126,6 +126,7 @@ fn report(
.or_else(|| symbol.idx.num.map(|num| num.to_string()))
.unwrap_or_default()
),
tags: Some(vec![DiagnosticTag::UNNECESSARY]),
..Default::default()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`0` is never used"
"message": "`0` is never used",
"tags": [
1
]
},
{
"range": {
Expand All @@ -35,7 +38,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`$f` is never used"
"message": "`$f` is never used",
"tags": [
1
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`0` is never used"
"message": "`0` is never used",
"tags": [
1
]
},
{
"range": {
Expand All @@ -35,7 +38,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`$g` is never used"
"message": "`$g` is never used",
"tags": [
1
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`$l` is never used"
"message": "`$l` is never used",
"tags": [
1
]
},
{
"range": {
Expand All @@ -35,7 +38,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`1` is never used"
"message": "`1` is never used",
"tags": [
1
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`0` is never used"
"message": "`0` is never used",
"tags": [
1
]
},
{
"range": {
Expand All @@ -35,7 +38,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`$m` is never used"
"message": "`$m` is never used",
"tags": [
1
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`$p` is never used"
"message": "`$p` is never used",
"tags": [
1
]
},
{
"range": {
Expand All @@ -35,7 +38,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`1` is never used"
"message": "`1` is never used",
"tags": [
1
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`0` is never used"
"message": "`0` is never used",
"tags": [
1
]
},
{
"range": {
Expand All @@ -35,7 +38,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`$table` is never used"
"message": "`$table` is never used",
"tags": [
1
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`0` is never used"
"message": "`0` is never used",
"tags": [
1
]
},
{
"range": {
Expand All @@ -35,7 +38,10 @@ expression: response
"severity": 2,
"code": "unused",
"source": "wat",
"message": "`$t` is never used"
"message": "`$t` is never used",
"tags": [
1
]
}
]
}

0 comments on commit fa4998c

Please sign in to comment.