Add isStatic method field (#3829)

PR adds `isStatic` field to suggestion. The field is required for Component Browser.
This commit is contained in:
Dmitry Bushev 2022-10-26 12:12:45 +03:00 committed by GitHub
parent 55b9bea352
commit 46441ca7a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 175 additions and 79 deletions

View File

@ -528,6 +528,9 @@ interface SuggestionEntryMethod {
/** The return type of this method. */ /** The return type of this method. */
returnType: string; returnType: string;
/** The flag indicating whether this method is static or instance. */
isStatic: boolean;
/** The documentation string. */ /** The documentation string. */
documentation?: string; documentation?: string;

View File

@ -181,6 +181,7 @@ object SearchProtocol {
arg +: conversion.arguments, arg +: conversion.arguments,
conversion.returnType, conversion.returnType,
conversion.returnType, conversion.returnType,
isStatic = false,
conversion.documentation, conversion.documentation,
conversion.documentationHtml, conversion.documentationHtml,
None, None,
@ -587,18 +588,6 @@ object SearchProtocol {
} }
} }
/** The result of the import request.
*
* @param module the definition module of the symbol
* @param symbol the resolved symbol
* @param exports the list of re-exports
*/
case class ImportResult(
module: String,
symbol: String,
exports: Seq[Export]
)
/** The request to invalidate the modules index. */ /** The request to invalidate the modules index. */
case object InvalidateModulesIndex case object InvalidateModulesIndex

View File

@ -58,6 +58,7 @@ object Suggestions {
), ),
selfType = "MyType", selfType = "MyType",
returnType = "Number", returnType = "Number",
isStatic = false,
documentation = Some("Lovely"), documentation = Some("Lovely"),
documentationHtml = None, documentationHtml = None,
documentationSections = Some(docSectionsBuilder.build("Lovely")) documentationSections = Some(docSectionsBuilder.build("Lovely"))
@ -96,6 +97,7 @@ object Suggestions {
), ),
selfType = "Any", selfType = "Any",
returnType = "Any", returnType = "Any",
isStatic = false,
documentation = Some("Lovely"), documentation = Some("Lovely"),
documentationHtml = None, documentationHtml = None,
documentationSections = Some(docSectionsBuilder.build("Lovely")) documentationSections = Some(docSectionsBuilder.build("Lovely"))
@ -110,6 +112,7 @@ object Suggestions {
), ),
selfType = "Number", selfType = "Number",
returnType = "Number", returnType = "Number",
isStatic = false,
documentation = None, documentation = None,
documentationHtml = None, documentationHtml = None,
documentationSections = None documentationSections = None
@ -124,6 +127,7 @@ object Suggestions {
), ),
selfType = "Integer", selfType = "Integer",
returnType = "Number", returnType = "Number",
isStatic = false,
documentation = Some("Blah, blah"), documentation = Some("Blah, blah"),
documentationHtml = None, documentationHtml = None,
documentationSections = Some(docSectionsBuilder.build("Blah, blah")) documentationSections = Some(docSectionsBuilder.build("Blah, blah"))

View File

@ -1251,6 +1251,7 @@ class SuggestionsHandlerSpec
arguments = Seq(), arguments = Seq(),
selfType = "Test.Main", selfType = "Test.Main",
returnType = "IO", returnType = "IO",
isStatic = true,
documentation = None, documentation = None,
documentationHtml = None, documentationHtml = None,
documentationSections = None documentationSections = None

View File

@ -155,6 +155,7 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
], ],
"selfType" : "MyType", "selfType" : "MyType",
"returnType" : "Number", "returnType" : "Number",
"isStatic" : false,
"documentation" : "Lovely", "documentation" : "Lovely",
"documentationSections" : [ "documentationSections" : [
{ {
@ -347,6 +348,48 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
"id" : 3, "id" : 3,
"result" : { "result" : {
"entries" : [ "entries" : [
{
"id" : 1,
"suggestion" : {
"type" : "atom",
"module" : "local.Test.Main",
"name" : "MyType",
"arguments" : [
{
"name" : "a",
"reprType" : "Any",
"isSuspended" : false,
"hasDefault" : false,
"defaultValue" : null,
"tagValues" : null
}
],
"returnType" : "MyAtom",
"documentation" : " PRIVATE\n\n A key-value store. This type assumes all keys are pairwise comparable,\n using the `<`, `>` and `==` operators.\n\n Arguments:\n - one: The first.\n - two_three: The *second*.\n\n ? Info\n Here is a thing.",
"documentationSections" : [
{
"type" : "tag",
"name" : "PRIVATE",
"body" : ""
},
{
"type" : "paragraph",
"body" : "A key-value store. This type assumes all keys are pairwise comparable, using the <code>&lt;</code>, <code>&gt;</code> and <code>==</code> operators. "
},
{
"type" : "keyed",
"key" : "Arguments",
"body" : " <ul><li>one: The first.</li><li>two_three: The <b>second</b>.</li></ul> "
},
{
"type" : "marked",
"mark" : "Info",
"header" : "Info",
"body" : " Here is a thing."
}
]
}
},
{ {
"id" : 3, "id" : 3,
"suggestion" : { "suggestion" : {
@ -393,68 +436,6 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
} }
} }
}, },
{
"id" : 1,
"suggestion" : {
"type" : "atom",
"module" : "local.Test.Main",
"name" : "MyType",
"arguments" : [
{
"name" : "a",
"reprType" : "Any",
"isSuspended" : false,
"hasDefault" : false,
"defaultValue" : null,
"tagValues" : null
}
],
"returnType" : "MyAtom",
"documentation" : " PRIVATE\n\n A key-value store. This type assumes all keys are pairwise comparable,\n using the `<`, `>` and `==` operators.\n\n Arguments:\n - one: The first.\n - two_three: The *second*.\n\n ? Info\n Here is a thing.",
"documentationSections" : [
{
"type" : "tag",
"name" : "PRIVATE",
"body" : ""
},
{
"type" : "paragraph",
"body" : "A key-value store. This type assumes all keys are pairwise comparable, using the <code>&lt;</code>, <code>&gt;</code> and <code>==</code> operators. "
},
{
"type" : "keyed",
"key" : "Arguments",
"body" : " <ul><li>one: The first.</li><li>two_three: The <b>second</b>.</li></ul> "
},
{
"type" : "marked",
"mark" : "Info",
"header" : "Info",
"body" : " Here is a thing."
}
]
}
},
{
"id" : 4,
"suggestion" : {
"type" : "local",
"externalId" : ${Suggestions.local.externalId.get},
"module" : "local.Test.Main",
"name" : "x",
"returnType" : "Number",
"scope" : {
"start" : {
"line" : 21,
"character" : 0
},
"end" : {
"line" : 89,
"character" : 0
}
}
}
},
{ {
"id" : 2, "id" : 2,
"suggestion" : { "suggestion" : {
@ -482,6 +463,7 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
], ],
"selfType" : "MyType", "selfType" : "MyType",
"returnType" : "Number", "returnType" : "Number",
"isStatic" : false,
"documentation" : "Lovely", "documentation" : "Lovely",
"documentationSections" : [ "documentationSections" : [
{ {
@ -490,6 +472,26 @@ class SuggestionsHandlerEventsTest extends BaseServerTest with FlakySpec {
} }
] ]
} }
},
{
"id" : 4,
"suggestion" : {
"type" : "local",
"externalId" : ${Suggestions.local.externalId.get},
"module" : "local.Test.Main",
"name" : "x",
"returnType" : "Number",
"scope" : {
"start" : {
"line" : 21,
"character" : 0
},
"end" : {
"line" : 89,
"character" : 0
}
}
}
} }
], ],
"currentVersion" : 4 "currentVersion" : 4

View File

@ -229,6 +229,7 @@ object Suggestion {
* @param arguments the list of arguments * @param arguments the list of arguments
* @param selfType the self type of a method * @param selfType the self type of a method
* @param returnType the return type of a method * @param returnType the return type of a method
* @param isStatic the flag indicating whether a method is static or instance
* @param documentation the documentation string * @param documentation the documentation string
* @param documentationHtml the documentation rendered as HTML * @param documentationHtml the documentation rendered as HTML
* @param reexport the module re-exporting this method * @param reexport the module re-exporting this method
@ -240,6 +241,7 @@ object Suggestion {
arguments: Seq[Argument], arguments: Seq[Argument],
selfType: String, selfType: String,
returnType: String, returnType: String,
isStatic: Boolean,
documentation: Option[String], documentation: Option[String],
documentationHtml: Option[String] = None, documentationHtml: Option[String] = None,
documentationSections: Option[List[DocSection]] = None, documentationSections: Option[List[DocSection]] = None,
@ -255,6 +257,7 @@ object Suggestion {
s"arguments=${arguments.map(_.toLogString(shouldMask))}," + s"arguments=${arguments.map(_.toLogString(shouldMask))}," +
s"selfType=$selfType," + s"selfType=$selfType," +
s"returnType=$returnType," + s"returnType=$returnType," +
s"isStatic=$isStatic," +
s"documentation=" + (if (shouldMask) documentation.map(_ => STUB) s"documentation=" + (if (shouldMask) documentation.map(_ => STUB)
else documentation) + else documentation) +
s",reexport=$reexport)" s",reexport=$reexport)"

View File

@ -170,6 +170,7 @@ class RuntimeSuggestionUpdatesTest
List(), List(),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -228,6 +229,7 @@ class RuntimeSuggestionUpdatesTest
List(), List(),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -308,6 +310,7 @@ class RuntimeSuggestionUpdatesTest
List(), List(),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -408,6 +411,7 @@ class RuntimeSuggestionUpdatesTest
List(), List(),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -518,6 +522,7 @@ class RuntimeSuggestionUpdatesTest
List(), List(),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -593,6 +598,7 @@ class RuntimeSuggestionUpdatesTest
), ),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -666,6 +672,7 @@ class RuntimeSuggestionUpdatesTest
), ),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -783,6 +790,7 @@ class RuntimeSuggestionUpdatesTest
Seq(), Seq(),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -827,6 +835,7 @@ class RuntimeSuggestionUpdatesTest
), ),
ConstantsGen.TEXT, ConstantsGen.TEXT,
ConstantsGen.ANY, ConstantsGen.ANY,
false,
None, None,
None, None,
None None
@ -854,6 +863,7 @@ class RuntimeSuggestionUpdatesTest
), ),
ConstantsGen.NUMBER, ConstantsGen.NUMBER,
ConstantsGen.ANY, ConstantsGen.ANY,
false,
None, None,
None, None,
None None
@ -988,6 +998,7 @@ class RuntimeSuggestionUpdatesTest
), ),
"Enso_Test.Test.A.MyType", "Enso_Test.Test.A.MyType",
ConstantsGen.ANY, ConstantsGen.ANY,
false,
None, None,
None, None,
None None
@ -1013,6 +1024,7 @@ class RuntimeSuggestionUpdatesTest
), ),
ConstantsGen.INTEGER, ConstantsGen.INTEGER,
ConstantsGen.ANY, ConstantsGen.ANY,
false,
None, None,
None, None,
None None
@ -1038,6 +1050,7 @@ class RuntimeSuggestionUpdatesTest
), ),
"Enso_Test.Test.A", "Enso_Test.Test.A",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None
@ -1090,6 +1103,7 @@ class RuntimeSuggestionUpdatesTest
List(), List(),
"Enso_Test.Test.Main", "Enso_Test.Test.Main",
ConstantsGen.ANY, ConstantsGen.ANY,
true,
None, None,
None, None,
None None

View File

@ -83,13 +83,14 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
_ _
) if !m.isStaticWrapperForInstanceMethod => ) if !m.isStaticWrapperForInstanceMethod =>
val typeSignature = ir.getMetadata(TypeSignatures) val typeSignature = ir.getMetadata(TypeSignatures)
val selfTypeOpt = typePtr match { val (selfTypeOpt, isStatic) = typePtr match {
case Some(typePtr) => case Some(typePtr) =>
typePtr val selfType = typePtr
.getMetadata(MethodDefinitions) .getMetadata(MethodDefinitions)
.map(_.target.qualifiedName) .map(_.target.qualifiedName)
selfType -> m.isStatic
case None => case None =>
Some(module) Some(module) -> true
} }
val methodOpt = selfTypeOpt.map { selfType => val methodOpt = selfTypeOpt.map { selfType =>
buildMethod( buildMethod(
@ -97,6 +98,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
module, module,
methodName.name, methodName.name,
selfType, selfType,
isStatic,
args, args,
doc, doc,
typeSignature typeSignature
@ -192,6 +194,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
module: QualifiedName, module: QualifiedName,
name: String, name: String,
selfType: QualifiedName, selfType: QualifiedName,
isStatic: Boolean,
args: Seq[IR.DefinitionArgument], args: Seq[IR.DefinitionArgument],
doc: Option[String], doc: Option[String],
typeSignature: Option[TypeSignatures.Metadata] typeSignature: Option[TypeSignatures.Metadata]
@ -206,6 +209,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
arguments = methodArgs, arguments = methodArgs,
selfType = selfType.toString, selfType = selfType.toString,
returnType = buildReturnType(returnTypeDef), returnType = buildReturnType(returnTypeDef),
isStatic = isStatic,
documentation = doc documentation = doc
) )
} }
@ -318,6 +322,7 @@ final class SuggestionBuilder[A: IndexedSource](val source: A) {
module = module, module = module,
name = getterName, name = getterName,
selfType = module.createChild(typeName), selfType = module.createChild(typeName),
isStatic = false,
args = Seq(thisArg), args = Seq(thisArg),
doc = None, doc = None,
typeSignature = None typeSignature = None

View File

@ -65,6 +65,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -95,6 +96,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = Some(" The foo") documentation = Some(" The foo")
), ),
Vector() Vector()
@ -126,6 +128,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = "Number", returnType = "Number",
isStatic = true,
documentation = Some(" The foo") documentation = Some(" The foo")
), ),
Vector() Vector()
@ -155,6 +158,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = "Foo.Bar", returnType = "Foo.Bar",
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -185,6 +189,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = "Number", returnType = "Number",
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -221,6 +226,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = "Number", returnType = "Number",
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -251,6 +257,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = "Foo.Bar Baz", returnType = "Foo.Bar Baz",
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -286,6 +293,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -337,6 +345,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -383,6 +392,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyType", selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -438,6 +448,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyAtom", selfType = "Unnamed.Test.MyAtom",
returnType = "Number", returnType = "Number",
isStatic = false,
documentation = Some(" My bar") documentation = Some(" My bar")
), ),
Vector() Vector()
@ -482,6 +493,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyAtom", selfType = "Unnamed.Test.MyAtom",
returnType = "Number", returnType = "Number",
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -572,6 +584,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Other_Atom", selfType = "Unnamed.Test.Other_Atom",
returnType = "Number", returnType = "Number",
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -601,6 +614,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -650,6 +664,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = "Unnamed.Test.A", returnType = "Unnamed.Test.A",
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -698,6 +713,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyType", selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -719,7 +735,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
) )
} }
"build conersion method for complex type" in { "build conversion method for complex type" in {
pending pending
val code = val code =
"""type MyMaybe """type MyMaybe
@ -765,6 +781,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyMaybe", selfType = "Unnamed.Test.MyMaybe",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -805,6 +822,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.New", selfType = "Unnamed.Test.New",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -846,6 +864,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -893,6 +912,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -953,6 +973,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1011,6 +1032,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1063,6 +1085,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1106,6 +1129,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1162,6 +1186,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1217,6 +1242,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1276,6 +1302,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyType", selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1291,6 +1318,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyType", selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1340,6 +1368,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Mtp", selfType = "Unnamed.Test.Mtp",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1355,6 +1384,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Mtp", selfType = "Unnamed.Test.Mtp",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1410,6 +1440,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Maybe", selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1470,6 +1501,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Maybe", selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1528,6 +1560,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.List", selfType = "Unnamed.Test.List",
returnType = "Unnamed.Test.List", returnType = "Unnamed.Test.List",
isStatic = true,
documentation = Some(" a method") documentation = Some(" a method")
), ),
Vector() Vector()
@ -1586,6 +1619,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Maybe", selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1603,6 +1637,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Maybe", selfType = "Unnamed.Test.Maybe",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1649,6 +1684,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyType", selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1664,6 +1700,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.MyType", selfType = "Unnamed.Test.MyType",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1676,6 +1713,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1720,6 +1758,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.Test", selfType = "Unnamed.Test.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1732,6 +1771,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1789,6 +1829,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test.A", selfType = "Unnamed.Test.A",
returnType = "Unnamed.Test.A", returnType = "Unnamed.Test.A",
isStatic = false,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1811,6 +1852,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = "Unnamed.Test.A", returnType = "Unnamed.Test.A",
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1823,6 +1865,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = List(), arguments = List(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1854,6 +1897,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector() Vector()
@ -1886,6 +1930,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1938,6 +1983,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
arguments = Seq(), arguments = Seq(),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = None documentation = None
), ),
Vector( Vector(
@ -1990,6 +2036,7 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
), ),
selfType = "Unnamed.Test", selfType = "Unnamed.Test",
returnType = SuggestionBuilder.Any, returnType = SuggestionBuilder.Any,
isStatic = true,
documentation = Some(" The foo") documentation = Some(" The foo")
), ),
Vector() Vector()

View File

@ -57,6 +57,7 @@ object SuggestionRandom {
arguments = Seq(), arguments = Seq(),
selfType = nextString(), selfType = nextString(),
returnType = nextString(), returnType = nextString(),
isStatic = Random.nextBoolean(),
documentation = optional(nextString()), documentation = optional(nextString()),
documentationHtml = optional(nextString()) documentationHtml = optional(nextString())
) )

View File

@ -989,6 +989,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = module, name = module,
selfType = SelfTypeColumn.EMPTY, selfType = SelfTypeColumn.EMPTY,
returnType = "", returnType = "",
isStatic = false,
scopeStartLine = ScopeColumn.EMPTY, scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY, scopeStartOffset = ScopeColumn.EMPTY,
scopeEndLine = ScopeColumn.EMPTY, scopeEndLine = ScopeColumn.EMPTY,
@ -1017,6 +1018,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name, name = name,
selfType = SelfTypeColumn.EMPTY, selfType = SelfTypeColumn.EMPTY,
returnType = returnType, returnType = returnType,
isStatic = false,
documentation = doc, documentation = doc,
scopeStartLine = ScopeColumn.EMPTY, scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY, scopeStartOffset = ScopeColumn.EMPTY,
@ -1032,6 +1034,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
args, args,
selfType, selfType,
returnType, returnType,
isStatic,
doc, doc,
_, _,
_, _,
@ -1046,6 +1049,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name, name = name,
selfType = selfType, selfType = selfType,
returnType = returnType, returnType = returnType,
isStatic = isStatic,
documentation = doc, documentation = doc,
scopeStartLine = ScopeColumn.EMPTY, scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY, scopeStartOffset = ScopeColumn.EMPTY,
@ -1081,6 +1085,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = toConversionMethodName(sourceType, returnType), name = toConversionMethodName(sourceType, returnType),
selfType = SelfTypeColumn.EMPTY, selfType = SelfTypeColumn.EMPTY,
returnType = returnType, returnType = returnType,
isStatic = false,
documentation = doc, documentation = doc,
scopeStartLine = ScopeColumn.EMPTY, scopeStartLine = ScopeColumn.EMPTY,
scopeStartOffset = ScopeColumn.EMPTY, scopeStartOffset = ScopeColumn.EMPTY,
@ -1099,6 +1104,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name, name = name,
selfType = SelfTypeColumn.EMPTY, selfType = SelfTypeColumn.EMPTY,
returnType = returnType, returnType = returnType,
isStatic = false,
documentation = None, documentation = None,
scopeStartLine = scope.start.line, scopeStartLine = scope.start.line,
scopeStartOffset = scope.start.character, scopeStartOffset = scope.start.character,
@ -1117,6 +1123,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
name = name, name = name,
selfType = SelfTypeColumn.EMPTY, selfType = SelfTypeColumn.EMPTY,
returnType = returnType, returnType = returnType,
isStatic = false,
documentation = None, documentation = None,
scopeStartLine = scope.start.line, scopeStartLine = scope.start.line,
scopeStartOffset = scope.start.character, scopeStartOffset = scope.start.character,
@ -1194,6 +1201,7 @@ final class SqlSuggestionsRepo(val db: SqlDatabase)(implicit
arguments = arguments.sortBy(_.index).map(toArgument), arguments = arguments.sortBy(_.index).map(toArgument),
selfType = suggestion.selfType, selfType = suggestion.selfType,
returnType = suggestion.returnType, returnType = suggestion.returnType,
isStatic = suggestion.isStatic,
documentation = suggestion.documentation, documentation = suggestion.documentation,
documentationHtml = None, documentationHtml = None,
documentationSections = None, documentationSections = None,

View File

@ -37,6 +37,7 @@ case class ArgumentRow(
* @param name the suggestion name * @param name the suggestion name
* @param selfType the self type of a suggestion * @param selfType the self type of a suggestion
* @param returnType the return type of a suggestion * @param returnType the return type of a suggestion
* @param isStatic the flag indicating whether a method is static or instance
* @param scopeStartLine the line of the start position of the scope * @param scopeStartLine the line of the start position of the scope
* @param scopeStartOffset the offset of the start position of the scope * @param scopeStartOffset the offset of the start position of the scope
* @param scopeEndLine the line of the end position of the scope * @param scopeEndLine the line of the end position of the scope
@ -52,6 +53,7 @@ case class SuggestionRow(
name: String, name: String,
selfType: String, selfType: String,
returnType: String, returnType: String,
isStatic: Boolean,
scopeStartLine: Int, scopeStartLine: Int,
scopeStartOffset: Int, scopeStartOffset: Int,
scopeEndLine: Int, scopeEndLine: Int,
@ -164,6 +166,7 @@ final class SuggestionsTable(tag: Tag)
def name = column[String]("name") def name = column[String]("name")
def selfType = column[String]("self_type") def selfType = column[String]("self_type")
def returnType = column[String]("return_type") def returnType = column[String]("return_type")
def isStatic = column[Boolean]("is_static")
def scopeStartLine = def scopeStartLine =
column[Int]("scope_start_line", O.Default(ScopeColumn.EMPTY)) column[Int]("scope_start_line", O.Default(ScopeColumn.EMPTY))
def scopeStartOffset = def scopeStartOffset =
@ -185,6 +188,7 @@ final class SuggestionsTable(tag: Tag)
name, name,
selfType, selfType,
returnType, returnType,
isStatic,
scopeStartLine, scopeStartLine,
scopeStartOffset, scopeStartOffset,
scopeEndLine, scopeEndLine,
@ -263,5 +267,5 @@ object SuggestionsVersion extends TableQuery(new SuggestionsVersionTable(_))
object SchemaVersion extends TableQuery(new SchemaVersionTable(_)) { object SchemaVersion extends TableQuery(new SchemaVersionTable(_)) {
/** The current schema version. */ /** The current schema version. */
val CurrentVersion: Long = 7 val CurrentVersion: Long = 8
} }

View File

@ -67,6 +67,7 @@ class SuggestionsRepoTest extends AnyWordSpec with Matchers with RetrySpec {
suggestion.module, suggestion.module,
suggestion.atom, suggestion.atom,
suggestion.method, suggestion.method,
suggestion.instanceMethod,
suggestion.conversion, suggestion.conversion,
suggestion.function, suggestion.function,
suggestion.local suggestion.local
@ -80,6 +81,7 @@ class SuggestionsRepoTest extends AnyWordSpec with Matchers with RetrySpec {
suggestion.module, suggestion.module,
suggestion.atom, suggestion.atom,
suggestion.method, suggestion.method,
suggestion.instanceMethod,
suggestion.conversion, suggestion.conversion,
suggestion.function, suggestion.function,
suggestion.local suggestion.local
@ -1727,6 +1729,19 @@ class SuggestionsRepoTest extends AnyWordSpec with Matchers with RetrySpec {
arguments = Seq(), arguments = Seq(),
selfType = "local.Test.Main", selfType = "local.Test.Main",
returnType = "Standard.Builtins.IO", returnType = "Standard.Builtins.IO",
isStatic = true,
documentation = None
)
val instanceMethod: Suggestion.Method =
Suggestion.Method(
externalId = Some(UUID.randomUUID()),
module = "local.Test.Main",
name = "foo",
arguments = Seq(),
selfType = "local.Test.Main.A",
returnType = "Standard.Builtins.Nothing",
isStatic = false,
documentation = None documentation = None
) )