Skip to content

Commit

Permalink
fixed sharp detection for complex sharp conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Jan 29, 2025
1 parent 12f0a60 commit ac63272
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/haxeLanguageServer/features/haxe/InlineValueFeature.hx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ class InlineValueFeature {
}

function onInlineValue(params:InlineValueParams, token:CancellationToken, resolve:Array<InlineValue>->Void, reject:ResponseError<NoData>->Void) {
final onResolve = context.startTimer("textDocument/inlineValue");
if (context.config.user.disableRefactorCache || context.config.user.disableInlineValue) {
resolve([]);
onResolve();
return;
}

var file = refactorCache.fileList.getFile(params.textDocument.uri.toFsPath().toString());
if (file == null) {
reject.handler()("file not found");
onResolve();
return;
}

Expand Down Expand Up @@ -129,6 +132,7 @@ class InlineValueFeature {
}

resolve(inlineValueVars);
onResolve();
}

function isSharpCondition(params:InlineValueParams, identifier:Identifier):Bool {
Expand All @@ -144,13 +148,8 @@ class InlineValueFeature {
case Dot:
case Const(CIdent(_)):
case POpen:
switch (TokenTreeCheckUtils.getPOpenType(parent)) {
case SwitchCondition:
return true;
default:
return false;
}
case Unop(_):
case Unop(OpNot):
case Binop(OpBoolAnd) | Binop(OpBoolOr):
case Sharp("if") | Sharp("elseif"):
return true;
default:
Expand Down

0 comments on commit ac63272

Please sign in to comment.