Coder Social home page Coder Social logo

haxe-tmlanguage's Introduction

Haxe Support for Visual Studio Code

This is an extension for Visual Studio Code that adds support for the Haxe language, leveraging the Haxe Language Server. It works best with the latest Haxe 4 release, but supports any Haxe version starting from 3.4.0.

demo

Some framework-specific extensions exist to extend the functionality further:

Features

This is just a brief overview of the supported features. For more details, check out our extensive documentation.

Building

For instructions on building/installing from source, please see the dedicated wiki page.

haxe-tmlanguage's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

haxe-tmlanguage's Issues

Invalid string interpolation

The compiler does not interpolate invalid identifiers (e.g. starting with number)

screen shot 2017-06-01 at 11 31 24 am

'$1' should not be highlighted as interpolation.

Single-letter uppercase constants

Uppercase identifiers are highlighted as variables, rather than types, but there's an exception for single-letter uppercase identifiers (mostly because that's a common in type paramters, e.g. T). This leads to issues like this:

We can probably get rid of this hack because the grammar should know about the places where type parameters can occur by now, and still highlight T etc correctly as a result.

Highlighting fails after arrow function with types

I don't think this is the case mentioned in #29 (comment)

With the type hint in the return, the highlighting stops for the following functions:

Screen Shot 2019-07-11 at 17 03 55

If I remove the type hint:

Screen Shot 2019-07-11 at 17 04 08

And a text version for copypasting (which also shows the problem):

abstract Callback<T>(CallbackData<T>) from CallbackData<T> {
	@:from static inline function fromOptionalErrorOnly(f:(?error:Error) -> Void):Callback<NoData> return (?err:Error, ?result:NoData) -> f(err);

	@:from static inline function fromErrorOnly(f:(error:Error) -> Void):Callback<NoData> return (?err:Error, ?result:NoData) -> f(err);
}

macro with colon

kind: FieldType.FProp("default", "null", macro:Dynamic, macro $v{sha})

Haxe highlighting not working properly

Hi, the haxe highlighting doesnt work properly for some reason, i would like to get help. I installed every extensions, but it doesnt work properly. The output says that the haxe language server runs fine.

image
image
image

Windows 11 22H2

Still highlight keywords in identifier locations

function foo(default:Int) {}
var default:Int;
default

default is highlighted as an identifier here. This gives the misleading impression that the code is correct, but in reality it does of course not compile. It would be better to still highlight keywords as such in these positions.

Complex compiler conditionals

screen shot 2017-03-07 at 10 38 45 pm

#elseif (!no_ssl && (hxssl || hl || cpp || (neko && !(macro || interp)))) new sys.ssl.Socket();

Note the last two closing parenthesis.

Conditional type declaration

#if hscriptPos
enum ExprDef {
#else
enum Expr {
#end
}

The second enum is not highlighted correctly. Probably an issue for all types (and in other places as well).

Hxml highlighting after -cmd

We highlight -xml as an argument here when it's actually still part of the command:

-cmd lime build flash -xml

function new( )

class C {
    function new( ) {} // note the space between parens, removing it fixes the coloring

    function f() { // broken
        trace("hi"); // better here :)
    }
}


see vshaxe/vshaxe#80

Highlighting stops in weird conditions

class Foo {
  function func() {
    switch x {
      case _:
        new X(Y(function () foo));
      case A({a: _}, _):
        // highlighting is broken at this point
        new Map<String, String>();
        trace("foobar");
        var x = 1 + 2;
        var etc = "etc";
    }
  }
}

It seems the lines with new X and case A are both required for the issue to happen. Can be alleviated by putting foo inside {}.

var in case

var option = haxe.ds.Option.Some(0);
switch (option) {
    case Some(var i): "foo";
    case None:
}

Type.property.Property highlighted as a type path

This is highlighted as Type.package.package.Type. It looks correct with a lowercase c:

Should be possible to say that it can't be a type path if the first segment (FlxG) looks like a type already.

Highlight lone package / Type in hxml

Type paths can occur not only after --main, but also with no argument preceding it, like the vshaxe.Main here:

Should be possible to highlight properly.

`case {x: _}` screws up highlighting

class Main {
    public static function main() {
        var obj = {
            foo: switch baz() {
                case {x: x}: [x];
            },
            bar: switch baz() {
                case {x: x}: [x];
            },
        }
   }
}

image

Braceless anonymous function scopes are not always closed

The grammar relies on a ; to close function scopes when there are no braces. However, for instance inside of function arguments, like in the following example, it doesn't ever get to match against the ;:

class C {
    function f() {
        f(
            function() f,
            function() f,
            function() f
        );
    }
}

As a result, there are too many function scopes on the stack that won't ever be closed:

This causes subsequent highlighting to break in some cases, for instance the type name T here:

Folds

With the old Haxe TM bundle, any { ... } block or structure was detected as such and it was possible (in TextMate 2) to collapse the blocks. With this repo, that feature is no longer available. Would it be possible to add folds for { ... } and conditional compilation?

Strings not highlighted in metadata

enum Item {
  @:json({ type: 'sword' }) Sword(damage:{max:Int});
  @:json({ type: 'shield' }) Shield(shield:{armor:Int});
  @:json({ type: 'staff' }) Staff(block:Float, ?magic:Int);
  Potion(effect:PotionEffect);
}

Strings highlighted incorrectly after var in call

This is a regression. Started occurring after updating to vshaxe 1.3.1.
Hope this is the right place to post the bug.

broken-after-var-in-ecall

working-without-var

Text Version:

class X {
    public static function a() {
        foo( var bar = 0
           , 'Specialize ${foo.toString()}'
           );
    }
}
class X {
    public static function a() {
        foo( bar = 0
           , 'Specialize ${foo.toString()}'
           );
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.