Coder Social home page Coder Social logo

hazelight / vscode-unreal-angelscript Goto Github PK

View Code? Open in Web Editor NEW
93.0 93.0 39.0 1.06 MB

Visual Studio Code Language Server and Debug Adapter for use with UnrealEngine-Angelscript.

License: MIT License

TypeScript 95.30% JavaScript 0.40% PEG.js 4.30%

vscode-unreal-angelscript's People

Contributors

andreehallengren avatar aoosg avatar dependabot[bot] avatar frals avatar haze-lucas avatar jakoblarsson-embark avatar joachimolergard avatar jonaskjellstrom avatar kaiwildlight avatar lucas7211 avatar maigo avatar mikeseese avatar moppius avatar tgolsson avatar vatyx avatar xertrov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vscode-unreal-angelscript's Issues

Can't get the extension to work in vscode extension debugger

Hi!

Running the extension in dev mode produces the following error:

Debugger listening on ws://127.0.0.1:6009/e15db50e-1d33-4325-b3de-649ff74998bc
For help, see: https://nodejs.org/en/docs/inspector
internal/modules/cjs/loader.js:720
    throw err;
    ^

Error: Cannot find module '/Users/Victor/Documents/vscode-unreal-angelscript/extension/server/server.js'
Require stack:
- /Users/Victor/Documents/vscode-unreal-angelscript/extension/node_modules/vscode-languageclient/lib/utils/electronForkStart.js
    at Function._resolveFilename (internal/modules/cjs/loader.js:717:15)
    at internal/modules/cjs/loader.js:622:27
    at electron/js2c/asar.js:717:26
    at Function._load (electron/js2c/asar.js:717:26)
    at Module.require (internal/modules/cjs/loader.js:775:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Server.<anonymous> (/Users/Victor/Documents/vscode-unreal-angelscript/extension/node_modules/vscode-languageclient/lib/utils/electronForkStart.js:110:9)
    at Server.emit (events.js:203:13)
    at Pipe.onconnection (net.js:1473:8) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/Victor/Documents/vscode-unreal-angelscript/extension/node_modules/vscode-languageclient/lib/utils/electronForkStart.js'
  ]
}
[Info  - 12:20:26 AM] Connection to server got closed. Server will restart.

Tried all kinds of different things to no avail, including running 'npm install' in extension directories. Any tips on getting this to work?

Separate the language server

Would it be possible to separate out the Angelscript language server in this project into a separate extension or repository so that it can be re-used for other non-Unreal related things, as well? A general-purpose AS language server would be really cool to have.

I still have very little experience with developing VSCode extensions, but I'm interested in getting a working (general-purpose) language server for some Angelscript-heavy projects I have.

problems with `>>`; e.g., `cast<TArray<T>>`, or `auto x = 2 >> 1` being detected as bool

I found this while developing the openplanet fork. I'm making an issue instead of a PR b/c you might prefer your own implementation. Here is my fix: XertroV@38cc55d#diff-4910283f7c594d7e0b62d17c3cc269acdb6182b6e865c129cc4e3ea2297f5820

The problem is mostly caused by 2 things at the same time: operator precedence and the lexer.

  1. the lexer splits up the doc in advance, so if something is matched by the lexer, it's treated as a single chunk.
  2. the only precedence that I found which worked is >>> over >> over >. a single rule like op_binary_shift -> ("<" "<" | ">" ">" | ">" ">" ">") did not work (only << and >> would be matched, never >>>). in part this was b/c it preferred (>>)(>) over >>>.

old behavior wrt operator precedence: a >> b would be parsed as ((a >) > b) due to the way the RHS of the expression is optional + the ability to match 2 > or >> in the same rule.

this meant that auto x = 2 >> 1 would be parsed as auto x = (2 >) > 1 which was (incorrectly) detected as a bool.

additionally, it meant that matching template types (or casts) of the form cast<TOuter<T>> or TOuter<TInner<T>> would fail b/c >> was detected as an operator and did not match individual > symbols.

solution:

  1. exclude >> and << from the lexer. instead, detect them in the parser with rules that match ">" ">" | "<" "<"
  2. ensure that no rules can match both >> and >>> (etc) at the same precedence
  3. longer operators need to take precedence

types are now correctly detected and nested template types are correctly parsed:

image

image

Crashing when hot reloading bad switch case

this code crashes on hot reload

enum EFoo
{
    Bar,
    Baz,
};
float FooFunc(EFoo Cond)
{
    switch (Cond)
    {
        case Bar:
            return 0.f;
        case Baz:
            return 0.f;
    }
}

this code does not (unclear on why it doesn't happen with a return post switch case)

enum EFoo
{
    Bar,
    Baz,
};
float FooFunc(EFoo Cond)
{
    switch (Cond)
    {
        case Bar:
            return 0.f;
        case Baz:
            return 0.f;
    }
    return 0.f
}

file decorations on parse errors and squiggles

Some code I wrote to add file decorations to show parse errors ("4 E" on RHS of file name + all in red), and also some code to add squiggles to parse errors. You're welcome to copy paste any of it if you'd like those features for this plugin.

File decorations: XertroV@f1d4024

Squiggle (v easy to implement): https://github.com/XertroV/vscode-openplanet-angelscript/blob/f1d4024a0bcb11748bea12ed35f292072e7a2cc8/language-server/src/ls_diagnostics.ts#L118-L133

edit: screenshot might help. (please excuse the not-markdown in the hover box thing)
image

Show signature of event/delegate on hover

Would be very useful to show the signature declaration of an event or delegate when hovering.

This should work both when hovering over the type name of the delegate, and when hovering over the name of a variable that is declared with a delegate type.

Adding "Find All References" functionality

Hello!

"Find All References" is something I frequently use in most editors and was very sad to see that this plugin doesn't have it, so I was thinking I could help out with implementing it. I had a look through the Language Server code, mainly as_file.ts and database.ts and it doesn't seem like the current structure suits well to querying for all references of a symbol, however if I'm mistaken please let me know.

My idea was build up a data structure, similar to export let database = new Map<string, DBType>(); which can specifically be queried for finding references to a symbol. The data structure would be modified on document modification and would contain info on both usages of types and variables. Potentially the complexity for local variables could be minimized here and enough context already exists inside an AScope, but I'm not sure how to implement "find all references" for member variables without some kind of structure to query. What are your thoughts?

Handle types support

Hi!

The support for handle types doesn't seem to be present. If variable 'bar' is of handle type 'Foo @' typing 'bar.' should bring up the intellisense/autocompletion menu but that doesn't seem to be the case. Am I missing something?

Thanks!

Malformed scope from curly braces in comments breaks autocomplete

If an Angelscript file that you are editing has a block comment or multiple lines commented out which include curly braces, the parser seems to require these to be correctly-matched or else autocomplete will stop working for this file.

Example 1

/*
if (bWhatever)
{
*/
FVector Foo;

Example 2

//if (bWhatever)
//{
FVector Foo;

In both of the above cases, you will get no autocomplete for typing anything after Foo.

Currently, if you add a closing curly brace inside the comment, autocomplete works as expected again.

Expected behaviour

All code inside comments is ignored for autocompletion and parsing. Curly braces are not required to match within comments.

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.