Skip to content

Commit

Permalink
Fix issues with empty parameter names treated as "_" by `core:odin/pa…
Browse files Browse the repository at this point in the history
…rser`
  • Loading branch information
DanielGavin committed Mar 18, 2024
1 parent ff6d5c9 commit 6ffb4ef
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/server/semantic_tokens.odin
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "core:odin/tokenizer"

import "src:common"


/*
Right now I might be setting the wrong types, since there is no documentation as to what should be what, and looking at other LSP there is no consistancy.
*/
Expand Down Expand Up @@ -138,6 +137,11 @@ write_semantic_node :: proc(
type: SemanticTokenTypes,
modifier: SemanticTokenModifiers,
) {
//Sometimes odin ast uses "_" for empty params.
if ident, ok := node.derived.(^ast.Ident); ok && ident.name == "_" {
return
}

position := common.get_relative_token_position(
node.pos.offset,
transmute([]u8)src,
Expand Down Expand Up @@ -250,17 +254,6 @@ visit_node :: proc(

#partial switch n in node.derived {
case ^Ellipsis:
/*
Issue with parser pos not being correct.
write_semantic_string(
builder,
node.pos,
"..",
ast_context.file.src,
.Operator,
.None,
)
*/
visit(n.expr, builder, ast_context)
case ^Ident:
modifier: SemanticTokenModifiers
Expand Down

0 comments on commit 6ffb4ef

Please sign in to comment.