Lots of improvements
This commit is contained in:
BIN
UpsilonLanguageServer/Lib/Microsoft.CSharp.dll
Normal file
BIN
UpsilonLanguageServer/Lib/Microsoft.CSharp.dll
Normal file
Binary file not shown.
216
UpsilonLanguageServer/Lib/Microsoft.CSharp.xml
Normal file
216
UpsilonLanguageServer/Lib/Microsoft.CSharp.xml
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><doc>
|
||||
<assembly>
|
||||
<name>Microsoft.CSharp</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException">
|
||||
<summary>Represents an error that occurs when a dynamic bind in the C# runtime binder is processed.</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException.#ctor">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException"></see> class.</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException.#ctor(System.String)">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException"></see> class that has a specified error message.</summary>
|
||||
<param name="message">The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException"></see> class that has serialized data.</summary>
|
||||
<param name="info">The object that holds the serialized object data about the exception being thrown..</param>
|
||||
<param name="context">The contextual information about the source or destination.</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException.#ctor(System.String,System.Exception)">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException"></see> class that has a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
<param name="message">The error message that explains the reason for the exception.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException">
|
||||
<summary>Represents an error that occurs when a dynamic bind in the C# runtime binder is processed.</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException.#ctor">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException"></see> class with a system-supplied message that describes the error.</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException.#ctor(System.String)">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException"></see> class with a specified message that describes the error.</summary>
|
||||
<param name="message">The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException"></see> class with serialized data.</summary>
|
||||
<param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> that holds the serialized object data about the exception being thrown.</param>
|
||||
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"></see> that contains contextual information about the source or destination.</param>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException.#ctor(System.String,System.Exception)">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException"></see> class that has a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
<param name="message">The error message that explains the reason for the exception.</param>
|
||||
<param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
|
||||
</member>
|
||||
<member name="T:Microsoft.CSharp.RuntimeBinder.Binder">
|
||||
<summary>Contains factory methods to create dynamic call site binders for CSharp.</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.BinaryOperation(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.Linq.Expressions.ExpressionType,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp binary operation binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="operation">The binary operation kind.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp binary operation binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.Convert(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.Type,System.Type)">
|
||||
<summary>Initializes a new CSharp convert binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="type">The type to convert to.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<returns>Returns a new CSharp convert binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.GetIndex(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp get index binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp get index binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.GetMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.String,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp get member binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="name">The name of the member to get.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp get member binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.Invoke(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp invoke binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp invoke binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.InvokeConstructor(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp invoke constructor binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp invoke constructor binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.String,System.Collections.Generic.IEnumerable{System.Type},System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp invoke member binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="name">The name of the member to invoke.</param>
|
||||
<param name="typeArguments">The list of type arguments specified for this invoke.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp invoke member binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.IsEvent(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.String,System.Type)">
|
||||
<summary>Initializes a new CSharp is event binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="name">The name of the event to look for.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<returns>Returns a new CSharp is event binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.SetIndex(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp set index binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp set index binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.SetMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.String,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp set member binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="name">The name of the member to set.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp set member binder.</returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.Binder.UnaryOperation(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags,System.Linq.Expressions.ExpressionType,System.Type,System.Collections.Generic.IEnumerable{Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo})">
|
||||
<summary>Initializes a new CSharp unary operation binder.</summary>
|
||||
<param name="flags">The flags with which to initialize the binder.</param>
|
||||
<param name="operation">The unary operation kind.</param>
|
||||
<param name="context">The <see cref="T:System.Type"></see> that indicates where this operation is used.</param>
|
||||
<param name="argumentInfo">The sequence of <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> instances for the arguments to this operation.</param>
|
||||
<returns>Returns a new CSharp unary operation binder.</returns>
|
||||
</member>
|
||||
<member name="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo">
|
||||
<summary>Represents information about C# dynamic operations that are specific to particular arguments at a call site. Instances of this class are generated by the C# compiler.</summary>
|
||||
</member>
|
||||
<member name="M:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags,System.String)">
|
||||
<summary>Initializes a new instance of the <see cref="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> class.</summary>
|
||||
<param name="flags">The flags for the argument.</param>
|
||||
<param name="name">The name of the argument, if named; otherwise null.</param>
|
||||
<returns>A new instance of the <see cref="Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"></see> class.</returns>
|
||||
</member>
|
||||
<member name="T:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags">
|
||||
<summary>Represents information about C# dynamic operations that are specific to particular arguments at a call site. Instances of this class are generated by the C# compiler.</summary>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.Constant">
|
||||
<summary>The argument is a constant.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.IsOut">
|
||||
<summary>The argument is passed to an out parameter.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.IsRef">
|
||||
<summary>The argument is passed to a ref parameter.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.IsStaticType">
|
||||
<summary>The argument is a <see cref="T:System.Type"></see> indicating an actual type name used in source. Used only for target objects in static calls.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.NamedArgument">
|
||||
<summary>The argument is a named argument.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.None">
|
||||
<summary>No additional information to represent.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags.UseCompileTimeType">
|
||||
<summary>The argument&#39;s compile-time type should be considered during binding.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags">
|
||||
<summary>Represents information about C# dynamic operations that are not specific to particular arguments at a call site. Instances of this class are generated by the C# compiler.</summary>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.BinaryOperationLogical">
|
||||
<summary>The binder represents a logical AND or logical OR that is part of a conditional logical operator evaluation.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.CheckedContext">
|
||||
<summary>The evaluation of this binder happens in a checked context.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.ConvertArrayIndex">
|
||||
<summary>The binder represents an implicit conversion for use in an array creation expression.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.ConvertExplicit">
|
||||
<summary>The binder represents an explicit conversion.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.InvokeSimpleName">
|
||||
<summary>The binder represents an invoke on a simple name.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.InvokeSpecialName">
|
||||
<summary>The binder represents an invoke on a specialname.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.None">
|
||||
<summary>There is no additional information required for this binder.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.ResultDiscarded">
|
||||
<summary>The binder is used in a position that does not require a result, and can therefore bind to a void returning method.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.ResultIndexed">
|
||||
<summary>The result of any bind is going to be indexed get a set index or get index binder.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.ValueFromCompoundAssignment">
|
||||
<summary>The value in this set index or set member comes a compound assignment operator.</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -10,7 +10,8 @@
|
||||
"Upsilon/1.0.0": {
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "2.0.3",
|
||||
"System.Collections.Immutable": "1.5.0"
|
||||
"System.Collections.Immutable": "1.5.0",
|
||||
"Microsoft.CSharp": "4.0.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"Upsilon.dll": {}
|
||||
@@ -29,6 +30,14 @@
|
||||
"fileVersion": "4.6.26515.6"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CSharp/4.0.0.0": {
|
||||
"runtime": {
|
||||
"Microsoft.CSharp.dll": {
|
||||
"assemblyVersion": "4.0.0.0",
|
||||
"fileVersion": "4.6.26515.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -58,6 +67,11 @@
|
||||
"sha512": "sha512-RGxi2aQoXgZ5ge0zxrKqI4PU9LrYYoLC+cnEnWXKsSduCOUhE1GEAAoTexUVT8RZOILQyy1B27HC8Xw/XLGzdQ==",
|
||||
"path": "system.collections.immutable/1.5.0",
|
||||
"hashPath": "system.collections.immutable.1.5.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CSharp/4.0.0.0": {
|
||||
"type": "reference",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Upsilon.Binder.VariableSymbols;
|
||||
using Upsilon.BoundTypes;
|
||||
using Upsilon.StandardLibraries;
|
||||
using Type = Upsilon.BaseTypes.Type;
|
||||
|
||||
namespace UpsilonLanguageServer
|
||||
@@ -24,18 +25,123 @@ namespace UpsilonLanguageServer
|
||||
var value = (JObject)innerProperty.Value;
|
||||
var type = value.GetValue("type", StringComparison.InvariantCultureIgnoreCase)?.ToString();
|
||||
var comment = value.GetValue("comment", StringComparison.InvariantCultureIgnoreCase)?.ToString();
|
||||
dic.Add(propertyName, new UserDataBoundProperty()
|
||||
if (string.Equals("function", type, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
Name = propertyName,
|
||||
ActualType = type,
|
||||
Comment = comment,
|
||||
Type = ParseType(type)
|
||||
});
|
||||
ParseMethod(value, dic, propertyName, type, comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
dic.Add(propertyName.ToLowerInvariant(), new UserDataBoundProperty()
|
||||
{
|
||||
Name = propertyName,
|
||||
ActualType = type,
|
||||
Comment = comment,
|
||||
Type = ParseType(type)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
BoundTypeHandler.LoadUserDataTypeDefinition(new UserDataBoundTypeDefinition(typeName, dic));
|
||||
}
|
||||
}
|
||||
|
||||
private static void ParseMethod(JObject value, IDictionary<string, UserDataBoundProperty> dic, string propertyName, string type, string comment)
|
||||
{
|
||||
var returnType = value.GetValue("returns", StringComparison.InvariantCultureIgnoreCase)?.ToString();
|
||||
var parameters = new List<UserDataBoundFunctionParameter>();
|
||||
if (value.GetValue("Parameters", StringComparison.InvariantCultureIgnoreCase) is JObject parameterJson)
|
||||
{
|
||||
var properties = parameterJson.Properties();
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var parameterName = property.Name;
|
||||
var parameterValue = (JObject) property.Value;
|
||||
var parType = parameterValue.GetValue("type", StringComparison.InvariantCultureIgnoreCase)
|
||||
?.ToString();
|
||||
var parComment = parameterValue.GetValue("comment", StringComparison.InvariantCultureIgnoreCase)
|
||||
?.ToString();
|
||||
var isOptional = parameterValue.GetValue("IsOptional", StringComparison.InvariantCultureIgnoreCase)
|
||||
?.ToObject<bool>();
|
||||
parameters.Add(new UserDataBoundFunctionParameter()
|
||||
{
|
||||
Name = parameterName,
|
||||
Type = ParseType(parType),
|
||||
Comment = parComment,
|
||||
IsOptional = isOptional.HasValue && isOptional.Value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
dic.Add(propertyName.ToLowerInvariant(), new UserDataBoundMethod()
|
||||
{
|
||||
Name = propertyName,
|
||||
ActualType = type,
|
||||
Comment = comment,
|
||||
Type = ParseType(type),
|
||||
ResultType = ParseType(returnType),
|
||||
Parameters = parameters.ToArray()
|
||||
});
|
||||
}
|
||||
|
||||
public static void LoadStaticVariables(string fileContent)
|
||||
{
|
||||
StaticScope.BoundScope = StaticScope.CreateStandardLibrary().Item2;
|
||||
var json = JObject.Parse(fileContent);
|
||||
foreach (var property in json.Properties())
|
||||
{
|
||||
var name = property.Name;
|
||||
var obj = (JObject)property.Value;
|
||||
var stringType = obj.GetValue("type", StringComparison.InvariantCultureIgnoreCase).ToString().ToLowerInvariant();
|
||||
var comments = obj.GetValue("comment", StringComparison.InvariantCultureIgnoreCase)?.ToString()
|
||||
.Split('\n');
|
||||
var type = ParseType(stringType);
|
||||
if (type == Type.UserData)
|
||||
{
|
||||
var boundType = BoundTypeHandler.GetTypeDefinition(stringType);
|
||||
if (boundType != null)
|
||||
{
|
||||
StaticScope.BoundScope.AssignToNearest(new UserDataVariableSymbol(name, boundType){CommentValue = comments});
|
||||
}
|
||||
else
|
||||
{
|
||||
StaticScope.BoundScope.AssignToNearest(new UserDataVariableSymbol(name, Type.Unknown){CommentValue = comments});
|
||||
}
|
||||
}
|
||||
else if (type == Type.Function)
|
||||
{
|
||||
var returnType = obj.GetValue("returns", StringComparison.InvariantCultureIgnoreCase).ToString().ToLowerInvariant();
|
||||
var parameters = new List<InternalFunctionVariableSymbol.InternalFunctionParameter>();
|
||||
if (obj.GetValue("Parameters", StringComparison.InvariantCultureIgnoreCase) is JObject parameterJson)
|
||||
{
|
||||
var properties = parameterJson.Properties();
|
||||
foreach (var prop in properties)
|
||||
{
|
||||
var parameterValue = (JObject) prop.Value;
|
||||
var parType = parameterValue.GetValue("type", StringComparison.InvariantCultureIgnoreCase)
|
||||
?.ToString();
|
||||
var parsedType = ParseType(parType);
|
||||
var isOptional = parameterValue.GetValue("IsOptional", StringComparison.InvariantCultureIgnoreCase)
|
||||
?.ToObject<bool>();
|
||||
parameters.Add(new InternalFunctionVariableSymbol.InternalFunctionParameter(parsedType,
|
||||
isOptional.HasValue && isOptional.Value));
|
||||
}
|
||||
}
|
||||
var parsedReturnType = ParseType(returnType);
|
||||
StaticScope.BoundScope.AssignToNearest(new InternalFunctionVariableSymbol(name, false,
|
||||
parsedReturnType, parameters.ToArray())
|
||||
{
|
||||
CommentValue = comments
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
StaticScope.BoundScope.AssignToNearest(new VariableSymbol(property.Name,
|
||||
type, false)
|
||||
{
|
||||
CommentValue = comments
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Type ParseType(string input)
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace UpsilonLanguageServer
|
||||
private static readonly ScriptOptions Options = new ScriptOptions()
|
||||
{
|
||||
ThrowExceptionOnError = false,
|
||||
SaveDataComments = true
|
||||
SaveDataComments = true,
|
||||
|
||||
};
|
||||
|
||||
private static async Task RealLint(TextDocument document, int maxNumberOfProblems, SessionDocument session,
|
||||
|
||||
@@ -16,9 +16,9 @@ using Microsoft.Extensions.Logging.Debug;
|
||||
|
||||
namespace UpsilonLanguageServer
|
||||
{
|
||||
static class Program
|
||||
internal static class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
var debugMode = args.Any(a => a.Equals("--debug", StringComparison.OrdinalIgnoreCase));
|
||||
#if WAIT_FOR_DEBUGGER
|
||||
|
||||
@@ -25,6 +25,11 @@ namespace UpsilonLanguageServer.Services
|
||||
{
|
||||
BoundTypeParser.LoadBoundTypes(File.ReadAllText(typesConfigFile));
|
||||
}
|
||||
var staticConfigFile = configPath + "/static.json";
|
||||
if (File.Exists(staticConfigFile))
|
||||
{
|
||||
BoundTypeParser.LoadStaticVariables(File.ReadAllText(staticConfigFile));
|
||||
}
|
||||
}
|
||||
return new InitializeResult(new ServerCapabilities
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using JsonRpc.Standard.Contracts;
|
||||
using LanguageServer.VsCode;
|
||||
using LanguageServer.VsCode.Contracts;
|
||||
using Upsilon.Binder;
|
||||
using Upsilon.Binder.VariableSymbols;
|
||||
using Upsilon.BoundTypes;
|
||||
using Upsilon.Utilities;
|
||||
using Type = Upsilon.BaseTypes.Type;
|
||||
@@ -148,7 +149,7 @@ namespace UpsilonLanguageServer.Services
|
||||
if (node is BoundFullStopIndexExpression indexExpression)
|
||||
{
|
||||
var expression = indexExpression.Expression;
|
||||
var variableSymbol = ResolveVariable(expression);
|
||||
var variableSymbol = Binder.ResolveVariable(expression, null);
|
||||
var result = await GetListFromVariableSymbol(variableSymbol);
|
||||
if (result != null)
|
||||
{
|
||||
@@ -166,7 +167,7 @@ namespace UpsilonLanguageServer.Services
|
||||
variables.Select(x =>
|
||||
{
|
||||
var (key, value) = x;
|
||||
return new CompletionItem(key,
|
||||
return new CompletionItem(value.Name,
|
||||
CompletionItemKind.Variable, value.Type.ToString(),
|
||||
x.Value.CommentValue == null
|
||||
? ""
|
||||
@@ -179,7 +180,7 @@ namespace UpsilonLanguageServer.Services
|
||||
|
||||
private static async Task<CompletionList> GetListFromVariableSymbol(VariableSymbol variableSymbol)
|
||||
{
|
||||
if (variableSymbol is FunctionParameterSymbol parameterSymbol &&
|
||||
if (variableSymbol is UserDataVariableSymbol parameterSymbol &&
|
||||
parameterSymbol.BoundTypeDefinition is UserDataBoundTypeDefinition udBoundDef)
|
||||
{
|
||||
return new CompletionList(
|
||||
@@ -206,34 +207,5 @@ namespace UpsilonLanguageServer.Services
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private VariableSymbol ResolveVariable(BoundExpression expression)
|
||||
{
|
||||
if (expression.Kind == BoundKind.VariableExpression)
|
||||
{
|
||||
var variableExpression = (BoundVariableExpression) expression;
|
||||
return variableExpression.Variable.VariableSymbol;
|
||||
}
|
||||
if (expression.Kind == BoundKind.BoundFullstopIndexExpression)
|
||||
{
|
||||
var fullStopIndexExpression = (BoundFullStopIndexExpression) expression;
|
||||
var indexerExpression = fullStopIndexExpression.Expression;
|
||||
var indexerVariable = ResolveVariable(indexerExpression);
|
||||
if (indexerVariable.Type == Type.Table)
|
||||
{
|
||||
return ((TableVariableSymbol)indexerVariable).Variables[fullStopIndexExpression.Index];
|
||||
}
|
||||
if (indexerVariable.Type == Type.UserData)
|
||||
{
|
||||
var bDefProperty = ((UserDataBoundTypeDefinition) ((FunctionParameterSymbol) indexerVariable)
|
||||
.BoundTypeDefinition).Properties[fullStopIndexExpression.Index];
|
||||
var boundDef = BoundTypeHandler.GetTypeDefinition(bDefProperty.ActualType);
|
||||
return new FunctionParameterSymbol(fullStopIndexExpression.Index, boundDef);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace UpsilonLanguageServer.Services
|
||||
StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var name = Path.GetFileName(localPath);
|
||||
if (string.Equals(Path.GetFileName(localPath), "types.json",
|
||||
if (string.Equals(name, "types.json",
|
||||
StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (change.Type == FileChangeType.Created || change.Type == FileChangeType.Changed)
|
||||
@@ -64,6 +64,19 @@ namespace UpsilonLanguageServer.Services
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (string.Equals(name, "static.json",
|
||||
StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (change.Type == FileChangeType.Created || change.Type == FileChangeType.Changed)
|
||||
{
|
||||
BoundTypeParser.LoadStaticVariables(File.ReadAllText(localPath));
|
||||
foreach (var doc in Session.Documents.Values)
|
||||
{
|
||||
var diag = await DiagnosticProvider.LintDocument(doc.Document, doc, Session.Settings.MaxNumberOfProblems);
|
||||
await Client.Document.PublishDiagnostics(doc.Document.Uri, diag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user