hazelight / vscode-unreal-angelscript Goto Github PK
View Code? Open in Web Editor NEWVisual Studio Code Language Server and Debug Adapter for use with UnrealEngine-Angelscript.
License: MIT License
Visual Studio Code Language Server and Debug Adapter for use with UnrealEngine-Angelscript.
License: MIT License
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?
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.
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.
>>>
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:
>>
and <<
from the lexer. instead, detect them in the parser with rules that match ">" ">" | "<" "<"
>>
and >>>
(etc) at the same precedencetypes are now correctly detected and nested template types are correctly parsed:
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
}
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)
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.
UActorComponent ActorComponent;
UActorComponent ActorComponent ;
In the above example, both will compile and work, but the bottom one will have not have functioning auto-complete.
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?
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!
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.
/*
if (bWhatever)
{
*/
FVector Foo;
//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.
All code inside comments is ignored for autocompletion and parsing. Curly braces are not required to match within comments.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.