fdorg / flashdevelop

FlashDevelop is a free and open source code editor.
MIT License
826 stars 222 forks source link

[haxe] Function body without braces breaks completion #2210

Open gene-pavlovsky opened 6 years ago

gene-pavlovsky commented 6 years ago

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.

SlavaRa commented 6 years ago

1907