Skip to content

Commit bb0523b

Browse files
committed
Merge branch 'master' of github.com:EmmyLua/EmmyLua-LanguageServer
2 parents f667fa5 + 52ee535 commit bb0523b

File tree

16 files changed

+542
-331
lines changed

16 files changed

+542
-331
lines changed

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/lexer/_LuaDocLexer.java

Lines changed: 298 additions & 287 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/parser/LuaDocParser.java

Lines changed: 81 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/LuaDocTagClass.java

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/comment/psi/impl/LuaDocTagClassImpl.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/gen/com/tang/intellij/lua/psi/LuaCallExpr.java

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EmmyLua-Common/src/main/java/com/tang/intellij/lua/doc.bnf

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ tag_field ::= TAG_NAME_FIELD access_modifier? ((('<' class_name_ref '>')? ID nul
212212
}
213213

214214
id_field ::= ID comment_string? {
215-
implements = [
216-
"com.tang.intellij.lua.comment.psi.LuaDocPsiElement"
217-
"com.tang.intellij.lua.psi.LuaClassField"
218-
"com.intellij.psi.PsiNameIdentifierOwner"
219-
]
215+
// implements = [
216+
// "com.tang.intellij.lua.comment.psi.LuaDocPsiElement"
217+
// "com.tang.intellij.lua.psi.LuaClassField"
218+
// "com.intellij.psi.PsiNameIdentifierOwner"
219+
// ]
220220

221221

222222
}
@@ -266,7 +266,12 @@ class_name_ref_list ::= class_name_ref (',' class_name_ref)* {
266266
methods = [getClasses]
267267
}
268268

269-
tag_class ::= (TAG_NAME_CLASS|TAG_NAME_MODULE|TAG_NAME_ENUM|TAG_NAME_INTERFACE) ID (EXTENDS class_name_ref_list)? comment_string? {
269+
270+
private generic_define_list ::= '<' generic_def (',' generic_def)* '>' {
271+
pin = 1
272+
}
273+
274+
tag_class ::= (TAG_NAME_CLASS|TAG_NAME_MODULE|TAG_NAME_ENUM|TAG_NAME_INTERFACE) ID (generic_define_list)? (EXTENDS class_name_ref_list)? comment_string? {
270275
pin = 2
271276
implements = [
272277
"com.tang.intellij.lua.comment.psi.LuaDocPsiElement"

EmmyLua-Common/src/main/java/com/tang/intellij/lua/doc.flex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ SINGLE_QUOTED_STRING='([^\\\']|\\\S|\\[\r\n])*'? //'([^\\'\r\n]|\\[^\r\n])*'?
135135
{ID} { yybegin(xCLASS_EXTEND); return ID; }
136136
}
137137
<xCLASS_EXTEND> {
138-
":" { beginType(); return EXTENDS;}
138+
"<" { _typeLevel++; return LT; }
139+
"," { return COMMA; }
140+
">" { _typeLevel--; return GT; }
141+
{ID} { if (_typeLevel > 0) { _typeReq = false; return ID; } else { yybegin(xCOMMENT_STRING); yypushback(yylength()); } }
142+
":" { if (_typeLevel == 0) {beginType(); return EXTENDS;} else { return EXTENDS; } }
139143
[^] { yybegin(xCOMMENT_STRING); yypushback(yylength()); }
140144
}
141145

EmmyLua-Common/src/main/java/com/tang/intellij/lua/editor/completion/ClassMemberCompletionProvider.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,11 @@ open class ClassMemberCompletionProvider : LuaCompletionProvider() {
268268
)
269269
val ele = handlerProcessor?.process(element, classMember, fnTy) ?: element
270270
completionResultSet.addElement(ele)
271+
271272
// correction completion
272273
if (!isColonStyle && firstParamIsSelf
274+
// 前缀长度大于等于3才显示纠正
275+
&& completionResultSet.prefixMatcher.prefix.length >= 3
273276
&& callType != Ty.STRING
274277
// workaround now
275278
&& callType is TyClass

EmmyLua-Common/src/main/java/com/tang/intellij/lua/ty/TyClass.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ interface ITyClass : ITy {
8383
fun recoverAlias(context: SearchContext, aliasSubstitutor: TyAliasSubstitutor): ITy {
8484
return this
8585
}
86+
87+
fun getClassCallType(context: SearchContext): ITyFunction?
8688
}
8789

8890
fun ITyClass.isVisibleInScope(project: Project, contextTy: ITy, visibility: Visibility): Boolean {
@@ -261,6 +263,14 @@ abstract class TyClass(
261263
return result
262264
}
263265

266+
override fun getClassCallType(context: SearchContext): ITyFunction? {
267+
val ty = findMemberType("ctor", context)
268+
if(ty is ITyFunction){
269+
return ty
270+
}
271+
return null
272+
}
273+
264274
override fun subTypeOf(other: ITy, context: SearchContext, strict: Boolean): Boolean {
265275
// class extends table
266276
if (other == Ty.TABLE) return true

EmmyLua-Common/src/main/java/com/tang/intellij/lua/ty/TyFunction.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface IFunSignature {
3434
val paramSignature: String
3535
val tyParameters: Array<TyParameter>
3636
val varargTy: ITy?
37+
val document: String?
3738
fun substitute(substitutor: ITySubstitutor): IFunSignature
3839
fun subTypeOf(other: IFunSignature, context: SearchContext, strict: Boolean): Boolean
3940
}
@@ -183,7 +184,8 @@ class FunSignature(
183184
override val returnTy: ITy,
184185
override val varargTy: ITy?,
185186
params: Array<LuaParamInfo>,
186-
tyParameters: Array<TyParameter> = emptyArray()
187+
tyParameters: Array<TyParameter> = emptyArray(),
188+
override val document: String = ""
187189
) : FunSignatureBase(colonCall, params, tyParameters) {
188190

189191
companion object {
@@ -446,6 +448,8 @@ class TyPsiFunction(private val colonCall: Boolean, val psi: LuaFuncBodyOwner, f
446448

447449
override val varargTy: ITy?
448450
get() = psi.varargType
451+
override val document: String?
452+
get() = null
449453
}
450454
}
451455

0 commit comments

Comments
 (0)