Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,551 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.display;
import haxe.display.JsonModuleTypes;
import haxe.display.Position;
import haxe.display.Protocol;
/**
Methods of the JSON-RPC-based `--display` protocol in Haxe 4.
A lot of the methods are *inspired* by the Language Server Protocol, but there is **no** intention to be directly compatible with it.
**/
@:publicFields
class DisplayMethods {
/**
The completion request is sent from the client to Haxe to request code completion.
Haxe automatically determines the type of completion to use based on the passed position, see `CompletionResultKind`.
**/
static inline var Completion = new HaxeRequestMethod<CompletionParams, CompletionResult>("display/completion");
/**
The request is sent from the client to Haxe to resolve additional information for a given completion item.
**/
static inline var CompletionItemResolve = new HaxeRequestMethod<CompletionItemResolveParams, CompletionItemResolveResult>("display/completionItem/resolve");
/**
The find references request is sent from the client to Haxe to find locations that reference the symbol at a given text document position.
**/
static inline var FindReferences = new HaxeRequestMethod<FindReferencesParams, GotoDefinitionResult>("display/references");
/**
The goto definition request is sent from the client to Haxe to resolve the definition location(s) of a symbol at a given text document position.
**/
static inline var GotoDefinition = new HaxeRequestMethod<PositionParams, GotoDefinitionResult>("display/definition");
/**
The goto implementation request is sent from the client to Haxe to resolve the implementation location(s) of a symbol at a given text document position.
**/
static inline var GotoImplementation = new HaxeRequestMethod<PositionParams, GotoDefinitionResult>("display/implementation");
/**
The goto type definition request is sent from the client to Haxe to resolve the type definition location(s) of a symbol at a given text document position.
**/
static inline var GotoTypeDefinition = new HaxeRequestMethod<PositionParams, GotoTypeDefinitionResult>("display/typeDefinition");
/**
The hover request is sent from the client to Haxe to request hover information at a given text document position.
**/
static inline var Hover = new HaxeRequestMethod<PositionParams, HoverResult>("display/hover");
/**
This request is sent from the client to Haxe to determine the package for a given file, based on class paths configuration.
**/
static inline var DeterminePackage = new HaxeRequestMethod<FileParams, DeterminePackageResult>("display/package");
/**
The signature help request is sent from the client to Haxe to request signature information at a given cursor position.
**/
static inline var SignatureHelp = new HaxeRequestMethod<SignatureHelpParams, SignatureHelpResult>("display/signatureHelp");
/*
TODO:
- finish completion
- diagnostics
- codeLens
- workspaceSymbols ("project/symbol"?)
*/
}
/** Completion **/
typedef CompletionParams = PositionParams & {
var wasAutoTriggered:Bool;
/** list of metas to include in responses **/
var ?meta:Array<String>;
}
typedef FieldResolution = {
/**
Whether it's valid to use the unqualified name of the field or not.
This is `false` if the identifier is shadowed.
**/
var isQualified:Bool;
/**
The qualifier that has to be inserted to use the field if `!isQualified`.
Can either be `this` or `super` for instance fields for the type name for `static` fields.
**/
var qualifier:String;
}
typedef DisplayLocal<T> = {
var id:Int;
var name:String;
var type:JsonType<T>;
var origin:LocalOrigin;
var capture:Bool;
var ?extra:{
var params:Array<JsonTypeParameter>;
var expr:JsonExpr;
};
var meta:JsonMetadata;
var pos:JsonPos;
var isInline:Bool;
var isFinal:Bool;
}
enum abstract LocalOrigin(Int) {
var LocalVariable;
var Argument;
var ForVariable;
var PatternVariable;
var CatchVariable;
var LocalFunction;
}
enum abstract ClassFieldOriginKind<T>(Int) {
/**
The field is declared on the current type itself.
**/
var Self:ClassFieldOriginKind<JsonModuleType<T>>;
/**
The field is a static field brought into context via a static import
(`import pack.Module.Type.field`).
**/
var StaticImport:ClassFieldOriginKind<JsonModuleType<T>>;
/**
The field is declared on a parent type, such as:
- a super class field that is not overriden
- a forwarded abstract field
**/
var Parent:ClassFieldOriginKind<JsonModuleType<T>>;
/**
The field is a static extension method brought
into context with the `using` keyword.
**/
var StaticExtension:ClassFieldOriginKind<JsonModuleType<T>>;
/**
This field doesn't belong to any named type, just an anonymous structure.
**/
var AnonymousStructure:ClassFieldOriginKind<JsonAnon>;
/**
Special fields built into the compiler, such as:
- `code` on single-character Strings
- `bind()` on functions.
**/
var BuiltIn:ClassFieldOriginKind<NoData>;
/**
The origin of this class field is unknown.
**/
var Unknown:ClassFieldOriginKind<NoData>;
}
typedef ClassFieldOrigin<T> = {
var kind:ClassFieldOriginKind<T>;
var ?args:T;
}
typedef ClassFieldOccurrence<T> = {
var field:JsonClassField;
var resolution:FieldResolution;
var ?origin:ClassFieldOrigin<T>;
}
enum abstract EnumFieldOriginKind<T>(Int) {
/**
The enum value is declared on the current type itself.
**/
var Self:EnumFieldOriginKind<JsonModuleType<T>>;
/**
The enum value is brought into context via a static import
(`import pack.Module.Enum.Value`).
**/
var StaticImport:EnumFieldOriginKind<JsonModuleType<T>>;
}
typedef EnumFieldOrigin<T> = {
var kind:EnumFieldOriginKind<T>;
var ?args:T;
}
typedef EnumFieldOccurrence<T> = {
var field:JsonEnumField;
var resolution:FieldResolution;
var ?origin:EnumFieldOrigin<T>;
}
enum abstract Literal(String) {
var Null = "null";
var True = "true";
var False = "false";
var This = "this";
var Trace = "trace";
}
enum abstract DisplayModuleTypeKind(Int) {
var Class;
var Interface;
var Enum;
var Abstract;
var EnumAbstract;
/** A `typedef` that is just an alias for another type. **/
var TypeAlias;
/** A `typedef` that is an alias for an anonymous structure. **/
var Struct;
/** A type name introduced by `import as` / `import in` **/
// var ImportAlias;
}
typedef DisplayModuleType = {
var path:JsonTypePath;
var pos:JsonPos;
var isPrivate:Bool;
var params:Array<DisplayModuleTypeParameter>;
var meta:JsonMetadata;
var doc:JsonDoc;
var isExtern:Bool;
var isFinal:Bool;
var isAbstract:Bool;
var kind:DisplayModuleTypeKind;
}
typedef DisplayModuleTypeParameter = {
var name:String;
var meta:JsonMetadata;
var constraints:Array<JsonType<Dynamic>>;
}
typedef DisplayLiteral<T> = {
var name:String;
}
enum abstract MetadataTarget(String) {
var Class = "TClass";
var ClassField = "TClassField";
var Abstract = "TAbstract";
var AbstractField = "TAbstractField";
var Enum = "TEnum";
var Typedef = "TTypedef";
var AnyField = "TAnyField";
var Expr = "TExpr";
var TypeParameter = "TTypeParameter";
}
enum abstract Platform(String) {
var Cross = "cross";
var Js = "js";
var Lua = "lua";
var Neko = "neko";
var Flash = "flash";
var Php = "php";
var Cpp = "cpp";
var Cs = "cs";
var Java = "java";
var Python = "python";
var Hl = "hl";
var Eval = "eval";
}
typedef Metadata = {
var name:String;
var doc:JsonDoc;
var parameters:Array<String>;
var platforms:Array<Platform>;
var targets:Array<MetadataTarget>;
var internal:Bool;
var ?links:Array<String>;
}
typedef Define = {
var name:String;
var value:Null<String>;
var doc:JsonDoc;
var parameters:Array<String>;
var platforms:Array<Platform>;
var links:Array<String>;
}
typedef Keyword = {
var name:KeywordKind;
}
enum abstract KeywordKind(String) to String {
var Implements = "implements";
var Extends = "extends";
var Function = "function";
var Var = "var";
var If = "if";
var Else = "else";
var While = "while";
var Do = "do";
var For = "for";
var Break = "break";
var Return = "return";
var Continue = "continue";
var Switch = "switch";
var Case = "case";
var Default = "default";
var Try = "try";
var Catch = "catch";
var New = "new";
var Throw = "throw";
var Untyped = "untyped";
var Cast = "cast";
var Macro = "macro";
var Package = "package";
var Import = "import";
var Using = "using";
var Public = "public";
var Private = "private";
var Static = "static";
var Extern = "extern";
var Dynamic = "dynamic";
var Override = "override";
var Overload = "overload";
var Class = "class";
var Interface = "interface";
var Enum = "enum";
var Abstract = "abstract";
var Typedef = "typedef";
var Final = "final";
var Inline = "inline";
}
/* enum abstract PackageContentKind(Int) {
var Module;
var Package;
}*/
typedef Package = {
var path:JsonPackagePath;
// var ?contents:Array<{name:String, kind:PackageContentKind}>;
}
typedef Module = {
var path:JsonModulePath;
// var ?contents:Array<ModuleType>;
}
enum abstract DisplayItemKind<T>(String) {
var Local:DisplayItemKind<DisplayLocal<Dynamic>>;
var ClassField:DisplayItemKind<ClassFieldOccurrence<Dynamic>>;
var EnumField:DisplayItemKind<EnumFieldOccurrence<Dynamic>>;
/** Only for the enum values in enum abstracts, other fields use `ClassField`. **/
var EnumAbstractField:DisplayItemKind<ClassFieldOccurrence<Dynamic>>;
var Type:DisplayItemKind<DisplayModuleType>;
var Package:DisplayItemKind<Package>;
var Module:DisplayItemKind<Module>;
var Literal:DisplayItemKind<DisplayLiteral<Dynamic>>;
var Metadata:DisplayItemKind<Metadata>;
var Keyword:DisplayItemKind<Keyword>;
var AnonymousStructure:DisplayItemKind<JsonAnon>;
var Expression:DisplayItemKind<JsonTExpr>;
var TypeParameter:DisplayItemKind<DisplayModuleTypeParameter>;
var Define:DisplayItemKind<Define>;
}
typedef DisplayItem<T> = {
var kind:DisplayItemKind<T>;
var args:T;
var ?type:JsonType<Dynamic>;
var ?index:Int;
}
typedef DisplayItemOccurrence<T> = {
var range:Range;
var item:DisplayItem<T>;
var ?moduleType:JsonModuleType<Dynamic>;
var ?moduleTypeFollowed:JsonModuleType<Dynamic>;
}
typedef FieldCompletionSubject<T> = DisplayItemOccurrence<T> & {
var ?iterator:{
var type:JsonType<Dynamic>;
};
var ?keyValueIterator:{
var key:JsonType<Dynamic>;
var value:JsonType<Dynamic>;
};
}
typedef ToplevelCompletion<T> = {
var ?expectedType:JsonType<T>;
var ?expectedTypeFollowed:JsonType<T>;
var ?compatibleTypes:Array<JsonType<Dynamic>>;
}
typedef StructExtensionCompletion = {
var isIntersectionType:Bool;
}
typedef PatternCompletion<T> = ToplevelCompletion<T> & {
var isOutermostPattern:Bool;
}
enum abstract CompletionModeKind<T>(Int) {
var Field:CompletionModeKind<FieldCompletionSubject<Dynamic>>;
var StructureField;
var Toplevel:CompletionModeKind<ToplevelCompletion<Dynamic>>;
var Metadata;
var TypeHint;
var Extends;
var Implements;
var StructExtension:CompletionModeKind<StructExtensionCompletion>;
var Import;
var Using;
var New;
var Pattern:CompletionModeKind<PatternCompletion<Dynamic>>;
var Override;
var TypeRelation;
var TypeDeclaration;
}
typedef CompletionMode<T> = {
var kind:CompletionModeKind<T>;
var ?args:T;
}
typedef CompletionResponse<T1, T2> = {
var items:Array<DisplayItem<T1>>;
var mode:CompletionMode<T2>;
var ?replaceRange:Range;
var ?isIncomplete:Bool;
var ?filterString:String;
}
typedef CompletionResult = Response<Null<CompletionResponse<Dynamic, Dynamic>>>;
/** CompletionItem Resolve **/
typedef CompletionItemResolveParams = {
var index:Int;
};
typedef CompletionItemResolveResult = Response<{
var item:DisplayItem<Dynamic>;
}>;
/** FindReferences **/
typedef FindReferencesParams = PositionParams & {
var ?kind:FindReferencesKind;
}
enum abstract FindReferencesKind(String) to String {
/**
Find only direct references to the requested symbol.
Does not look for references to parent or overriding methods.
**/
var Direct = "direct";
/**
Find references to the base field and all the overidding fields in the inheritance chain.
**/
var WithBaseAndDescendants = "withBaseAndDescendants";
/**
Find references to the requested field and references to all
descendants of the requested field.
**/
var WithDescendants = "withDescendants";
}
/** GotoDefinition **/
typedef GotoDefinitionResult = Response<Array<Location>>;
/** GotoTypeDefinition **/
typedef GotoTypeDefinitionResult = Response<Array<Location>>;
/** Hover **/
typedef HoverResult = Response<Null<HoverDisplayItemOccurence<Dynamic>>>;
typedef HoverDisplayItemOccurence<T> = DisplayItemOccurrence<T> & {
var ?expected:{
var ?type:JsonType<Dynamic>;
var ?name:{
var name:String;
var kind:HoverExpectedNameKind;
var ?doc:String;
};
};
}
enum abstract HoverExpectedNameKind(Int) {
var FunctionArgument;
var StructureField;
}
/** DeterminePackage **/
typedef DeterminePackageResult = Response<Array<String>>;
/** SignatureHelp **/
typedef SignatureHelpParams = PositionParams & {
var wasAutoTriggered:Bool;
}
typedef SignatureInformation = JsonFunctionSignature & {
var ?documentation:String;
}
enum abstract SignatureItemKind(Int) {
var Call;
var ArrayAccess;
}
typedef SignatureItem = {
var signatures:Array<SignatureInformation>;
var activeSignature:Int;
var activeParameter:Int;
var kind:SignatureItemKind;
}
typedef SignatureHelpResult = Response<Null<SignatureItem>>;
/** General types **/
typedef PositionParams = FileParams & {
/** Unicode character offset in the file. **/
var offset:Int;
var ?contents:String;
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.display;
abstract FsPath(String) {
public inline function new(path:String) {
this = path;
}
public inline function toString():String {
return this;
}
}

View File

@ -0,0 +1,375 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.display;
typedef JsonTodo = Dynamic;
typedef JsonPos = {
var file:String;
var min:Int;
var max:Int;
}
typedef JsonDoc = Null<String>;
enum abstract ImportStatus(Int) {
/**
This type is already available with it's unqualified name for one of these reasons:
- it's a toplevel type
- it's imported with an `import` in the current module
- it's imported in an `import.hx` file
**/
var Imported;
/**
The type is currently not imported. It can be accessed either
with its fully qualified name or by inserting an import.
**/
var Unimported;
/**
A type with the same name is already imported in the module.
The fully qualified name has to be used to access it.
**/
var Shadowed;
}
/* Type instance */
typedef JsonPackagePath = {
var pack:Array<String>;
}
typedef JsonModulePath = JsonPackagePath & {
var moduleName:String;
var ?importStatus:ImportStatus;
}
typedef JsonTypePath = JsonModulePath & {
var typeName:String;
}
typedef JsonStaticFieldPath = JsonTypePath & {
var fieldName:String;
}
typedef JsonTypePathWithParams = {
var path:JsonTypePath;
var params:JsonTypes;
}
typedef JsonFunctionArgument = {
var name:String;
var opt:Bool;
var t:JsonType<Dynamic>;
var ?value:{
var string:String;
};
}
typedef JsonFunctionSignature = {
var args:Array<JsonFunctionArgument>;
var ret:JsonType<Dynamic>;
}
enum abstract JsonAnonStatusKind<T>(String) {
var AClosed;
var AOpened;
var AConst;
var AExtend:JsonAnonStatusKind<JsonTypes>;
var AClassStatics:JsonAnonStatusKind<JsonTypePath>;
var AEnumStatics:JsonAnonStatusKind<JsonTypePath>;
var AAbstractStatics:JsonAnonStatusKind<JsonTypePath>;
}
typedef JsonAnonStatus<T> = {
var kind:JsonAnonStatusKind<T>;
var args:T;
}
typedef JsonAnon = {
var fields:JsonClassFields;
var status:JsonAnonStatus<Dynamic>;
}
enum abstract JsonTypeKind<T>(String) {
var TMono;
var TInst:JsonTypeKind<JsonTypePathWithParams>;
var TEnum:JsonTypeKind<JsonTypePathWithParams>;
var TType:JsonTypeKind<JsonTypePathWithParams>;
var TAbstract:JsonTypeKind<JsonTypePathWithParams>;
var TFun:JsonTypeKind<JsonFunctionSignature>;
var TAnonymous:JsonTypeKind<JsonAnon>;
var TDynamic:JsonTypeKind<Null<JsonType<Dynamic>>>;
}
typedef JsonType<T> = {
var kind:JsonTypeKind<T>;
var args:T;
}
typedef JsonTypes = Array<JsonType<Dynamic>>;
/* Type parameters */
typedef JsonTypeParameter = {
var name:String;
var constraints:JsonTypes;
}
typedef JsonTypeParameters = Array<JsonTypeParameter>;
/* Expr */
enum abstract JsonBinopKind<T>(String) {
var OpAdd;
var OpMult;
var OpDiv;
var OpSub;
var OpAssign;
var OpEq;
var OpNotEq;
var OpGt;
var OpGte;
var OpLt;
var OpLte;
var OpAnd;
var OpOr;
var OpXor;
var OpBoolAnd;
var OpBoolOr;
var OpShl;
var OpShr;
var OpUShr;
var OpMod;
var OpAssignOp:JsonBinopKind<JsonBinop<Dynamic>>;
var OpInterval;
var OpArrow;
var OpIn;
}
typedef JsonBinop<T> = {
var kind:JsonBinopKind<T>;
var args:T;
}
enum abstract JsonUnop(String) {
var OpIncrement;
var OpDecrement;
var OpNot;
var OpNeg;
var OpNegBits;
}
typedef JsonExpr = JsonTodo;
typedef JsonMetadataEntry = {
var name:String;
var args:Array<JsonExpr>;
var pos:JsonPos;
}
typedef JsonMetadata = Array<JsonMetadataEntry>;
enum abstract JsonTConstantKind<T>(String) {
var TInt:JsonTConstantKind<String>;
var TFloat:JsonTConstantKind<String>;
var TString:JsonTConstantKind<String>;
var TBool:JsonTConstantKind<Bool>;
var TNull;
var TThis;
var TSuper;
}
typedef JsonTConstant<T> = {
var kind:JsonTConstantKind<T>;
var args:T;
}
typedef JsonTExpr = JsonTodo;
/* Fields */
enum abstract JsonVarAccessKind<T>(String) {
var AccNormal;
var AccNo;
var AccNever;
var AccResolve;
var AccCall;
var AccInline;
var AccRequire:JsonVarAccessKind<{require:String, message:Null<String>}>;
var AccCtor;
}
typedef JsonVarAccess<T> = {
var kind:JsonVarAccessKind<T>;
var args:T;
}
enum abstract JsonMethodKind(String) {
var MethNormal;
var MethInline;
var MethDynamic;
var MethMacro;
}
enum abstract JsonFieldKindKind<T>(String) {
var FVar:JsonFieldKindKind<{read:JsonVarAccess<Dynamic>, write:JsonVarAccess<Dynamic>}>;
var FMethod:JsonFieldKindKind<JsonMethodKind>;
}
typedef JsonFieldKind<T> = {
var kind:JsonFieldKindKind<T>;
var args:T;
}
enum abstract JsonClassFieldScope(Int) {
var Static;
var Member;
var Constructor;
}
typedef JsonClassField = {
var name:String;
var type:JsonType<Dynamic>;
var isPublic:Bool;
var isFinal:Bool;
var isAbstract:Bool;
var params:JsonTypeParameters;
var meta:JsonMetadata;
var kind:JsonFieldKind<Dynamic>;
var ?expr:{
var string:String;
};
var pos:JsonPos;
var doc:JsonDoc;
var overloads:JsonClassFields;
var scope:JsonClassFieldScope;
}
typedef JsonClassFields = Array<JsonClassField>;
typedef JsonClassFieldReference = String;
typedef JsonEnumField = {
var name:String;
var type:JsonType<Dynamic>;
var pos:JsonPos;
var meta:JsonMetadata;
var index:Int;
var doc:JsonDoc;
var params:JsonTypeParameters;
}
typedef JsonEnumFields = Array<JsonEnumField>;
/* Class */
enum abstract JsonClassKindKind<T>(String) {
var KNormal;
var KTypeParameter:JsonClassKindKind<JsonTypes>;
var KExtension:JsonClassKindKind<JsonTypePathWithParams>;
var KExpr:JsonClassKindKind<JsonExpr>;
var KGeneric;
var KGenericInstance:JsonClassKindKind<JsonTypePathWithParams>;
var KMacroType;
var KAbstractImpl:JsonClassKindKind<JsonTypePath>;
var KGenericBuild;
var KModuleFields:JsonClassKindKind<JsonModulePath>;
}
typedef JsonClassKind<T> = {
var kind:JsonClassKindKind<T>;
var args:T;
}
typedef JsonClass = {
var kind:JsonClassKind<Dynamic>;
var isInterface:Bool;
var isExtern:Bool;
var isFinal:Bool;
var isAbstract:Bool;
var superClass:Null<JsonTypePathWithParams>;
var interfaces:Array<JsonTypePathWithParams>;
var fields:JsonClassFields;
var statics:JsonClassFields;
var constructor:Null<JsonClassField>;
var init:Null<JsonTExpr>;
var overrides:Array<JsonClassFieldReference>;
}
/* Enum */
typedef JsonEnum = {
var constructors:JsonEnumFields;
var isExtern:Bool;
}
/* Typedef */
typedef JsonTypedef = {
var type:JsonType<Dynamic>;
}
/* Abstract */
typedef JsonAbstractBinop = {
var op:JsonBinop<Dynamic>;
var field:JsonClassFieldReference;
}
typedef JsonAbstractUnop = {
var op:JsonUnop;
var postFix:Bool;
var field:JsonClassFieldReference;
}
typedef JsonAbstractCast = {
var t:JsonType<Dynamic>;
var field:JsonClassFieldReference;
}
typedef JsonAbstract = {
var type:JsonType<Dynamic>;
var impl:Null<JsonClass>;
var binops:Array<JsonAbstractBinop>;
var unops:Array<JsonAbstractUnop>;
var from:Array<JsonAbstractCast>;
var to:Array<JsonAbstractCast>;
var array:JsonClassFields;
var resolve:Null<JsonClassFieldReference>;
}
/* Module type */
enum abstract JsonModuleTypeKind<T>(String) {
var Class:JsonModuleTypeKind<JsonClass> = "class";
var Enum:JsonModuleTypeKind<JsonEnum> = "enum";
var Typedef:JsonModuleTypeKind<JsonTypedef> = "typedef";
var Abstract:JsonModuleTypeKind<JsonAbstract> = "abstract";
}
typedef JsonModuleType<T> = {
var pack:Array<String>;
var name:String;
var moduleName:String;
var pos:JsonPos;
var isPrivate:Bool;
var params:JsonTypeParameters;
var meta:JsonMetadata;
var doc:JsonDoc;
var kind:JsonModuleTypeKind<T>;
var args:T;
}
typedef JsonModuleTypes = Array<JsonModuleType<Dynamic>>;

View File

@ -0,0 +1,61 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.display;
/**
Position in a text document expressed as 1-based line and character offset.
**/
typedef Position = {
/**
Line position in a document (1-based).
**/
var line:Int;
/**
Character offset on a line in a document (1-based).
**/
var character:Int;
}
/**
A range in a text document expressed as (1-based) start and end positions.
**/
typedef Range = {
/**
The range's start position
**/
var start:Position;
/**
The range's end position
**/
var end:Position;
}
/**
Represents a location inside a resource, such as a line inside a text file.
**/
typedef Location = {
var file:FsPath;
var range:Range;
}

View File

@ -0,0 +1,111 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.display;
import haxe.display.Position;
@:publicFields
class Methods {
/**
The initialize request is sent from the client to Haxe to determine the capabilities.
**/
static inline var Initialize = new HaxeRequestMethod<InitializeParams, InitializeResult>("initialize");
}
/* Initialize */
typedef InitializeParams = {
final ?supportsResolve:Bool;
/** dot paths to exclude from readClassPaths / toplevel completion **/
final ?exclude:Array<String>;
/** The maximum number of completion items to return **/
final ?maxCompletionItems:Int;
}
/**
Represents a semantic version, see https://semver.org/.
**/
typedef Version = {
final major:Int;
final minor:Int;
final patch:Int;
final ?pre:String;
final ?build:String;
}
typedef InitializeResult = Response<{
final protocolVersion:Version;
final haxeVersion:Version;
final methods:Array<String>;
}>;
/* general protocol types */
typedef Timer = {
final name:String;
final time:Float;
final ?path:String;
final ?info:String;
final ?calls:Int;
final ?percentTotal:Float;
final ?percentParent:Float;
final ?children:Array<Timer>;
}
typedef Response<T> = {
final ?result:T;
/** UNIX timestamp at the moment the data was sent. **/
final ?timestamp:Float;
/** Only sent if `--times` is enabled. **/
final ?timers:Timer;
}
typedef FileParams = {
var file:FsPath;
}
abstract HaxeRequestMethod<TParams, TResponse>(String) to String {
public inline function new(method:String)
this = method;
}
abstract HaxeNotificationMethod<TParams>(String) to String {
public inline function new(method:String)
this = method;
}
typedef HaxeResponseErrorData = Array<{
var severity:HaxeResponseErrorSeverity;
var ?location:Location;
var message:String;
}>;
enum abstract HaxeResponseErrorSeverity(Int) {
var Error = 1;
var Warning;
var Hint;
}
enum NoData {}

View File

@ -0,0 +1,167 @@
/*
* Copyright (C)2005-2019 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package haxe.display;
import haxe.display.JsonModuleTypes;
import haxe.display.Position;
import haxe.display.Protocol;
@:publicFields
class ServerMethods {
/**
This request is sent from the client to Haxe to explore the class paths. This effectively creates a cache for toplevel completion.
**/
static inline var ReadClassPaths = new HaxeRequestMethod<NoData, Response<{?files:Int}>>("server/readClassPaths");
static inline var Configure = new HaxeRequestMethod<ConfigureParams, Response<NoData>>("server/configure");
static inline var Invalidate = new HaxeRequestMethod<FileParams, Response<NoData>>("server/invalidate");
static inline var Contexts = new HaxeRequestMethod<NoData, Response<Array<HaxeServerContext>>>("server/contexts");
static inline var Memory = new HaxeRequestMethod<NoData, Response<HaxeMemoryResult>>("server/memory");
static inline var ContextMemory = new HaxeRequestMethod<ContextParams, Response<HaxeContextMemoryResult>>("server/memory/context");
static inline var ModuleMemory = new HaxeRequestMethod<ModuleParams, Response<HaxeModuleMemoryResult>>("server/memory/module");
static inline var Modules = new HaxeRequestMethod<ContextParams, Response<Array<String>>>("server/modules");
static inline var Module = new HaxeRequestMethod<ModuleParams, Response<JsonModule>>("server/module");
static inline var Files = new HaxeRequestMethod<ContextParams, Response<Array<JsonServerFile>>>("server/files");
static inline var ModuleCreated = new HaxeRequestMethod<FileParams, Response<NoData>>("server/moduleCreated");
}
/* Configure */
typedef ConfigurePrintParams = {
var ?addedDirectory:Bool;
var ?foundDirectories:Bool;
var ?changedDirectories:Bool;
var ?modulePathChanged:Bool;
var ?notCached:Bool;
var ?parsed:Bool;
var ?removedDirectory:Bool;
var ?reusing:Bool;
var ?skippingDep:Bool;
var ?unchangedContent:Bool;
var ?cachedModules:Bool;
var ?arguments:Bool;
var ?completion:Bool;
var ?defines:Bool;
var ?signature:Bool;
var ?displayPosition:Bool;
var ?stats:Bool;
var ?message:Bool;
var ?socketMessage:Bool;
var ?uncaughtError:Bool;
var ?newContext:Bool;
}
typedef ConfigureParams = {
final ?noModuleChecks:Bool;
final ?legacyCompletion:Bool;
final ?print:ConfigurePrintParams;
}
/* Contexts */
typedef HaxeServerContext = {
final index:Int;
final desc:String;
final signature:String;
final platform:String;
final classPaths:Array<String>;
final defines:Array<{key:String, value:String}>;
}
typedef ModuleId = {
final path:String;
final sign:String;
}
typedef JsonModule = {
final id:Int;
final path:JsonModulePath;
final types:Array<JsonTypePath>;
final file:String;
final sign:String;
final dependencies:Array<ModuleId>;
}
typedef JsonServerFile = {
final file:String;
final time:Float;
final pack:String;
final moduleName:Null<String>;
}
/* Memory */
typedef HaxeMemoryResult = {
final contexts:Array<{
final context:HaxeServerContext;
final size:Int;
}>;
final memory:{
final totalCache:Int;
final contextCache:Int;
final haxelibCache:Int;
final directoryCache:Int;
final nativeLibCache:Int;
final ?additionalSizes:Array<{name:String, size:Int}>;
}
}
typedef HaxeContextMemoryResult = {
final moduleCache:{
final size:Int;
final list:Array<{
final path:String;
final size:Int;
final hasTypes:Bool;
}>;
};
final syntaxCache:{
final size:Int;
};
final ?leaks:Array<{
final path:String;
final leaks:Array<{
final path:String;
}>;
}>;
}
typedef HaxeModuleMemoryResult = {
final moduleExtra:Int;
final types:Array<{
final name:String;
final ?pos:Location;
final size:Int;
final fields:Array<{
final name:String;
final ?pos:Location;
final size:Int;
}>;
}>;
}
typedef ContextParams = {
final signature:String;
}
typedef ModuleParams = ContextParams & {
final path:String;
}