Skip to content

[haxe] Function body without braces breaks completion #2210

Open
@gene-pavlovsky

Description

@gene-pavlovsky

In Haxe, braces around function bodies are optional in case the body is a single expression.
E.g. the following is valid code

    static function formatEvenness(i:Int):String
    	return i % 2 == 0
            ? "even"
            : "odd";

However it seems support for this style was never added to FD.
E.g. trying to write code like this (note that _ represents the caret, not the _ character):

package;

class Main {
	var str:String;
	
	function foo()
		st_
}

Press Ctrl-Space.
Expected: str offered as completion.
Actual: static offered as completion and other keywords suitable for class members, line is unindented one level. It's clear that FD thinks we're still in the class context, not inside the body of function foo as should be the case.

This is quite serious limitation when working with code written in this avoid-unnecessary-braces style.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions