Skip to content

Commit 97a94f6

Browse files
committed
优化性能,暂时移除deprecated诊断
1 parent d3d65ef commit 97a94f6

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

EmmyLua-LS/src/main/kotlin/com/tang/vscode/LuaLanguageServer.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ class LuaLanguageServer : LanguageServer, LanguageClientAware {
120120
val didChangeWorkspaceFolders = Registration(WORKSPACE_FOLDERS_CAPABILITY_ID, WORKSPACE_FOLDERS_CAPABILITY_NAME)
121121
client?.registerCapability(RegistrationParams(listOf(didChangeWorkspaceFolders)))
122122

123-
workspaceService.loadWorkspace()
123+
if(VSCodeSettings.clientType != "vsc"){
124+
workspaceService.loadWorkspace()
125+
}
124126
}
125127

126128
override fun getWorkspaceService(): WorkspaceService {

EmmyLua-LS/src/main/kotlin/com/tang/vscode/diagnostics/DiagnosticsService.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ object DiagnosticsService {
3636
}
3737
}
3838
is LuaIndexExpr -> {
39-
indexDeprecatedInspections(it, file, diagnostics)
39+
// indexDeprecatedInspections(it, file, diagnostics)
4040
fieldValidationInspections(it, file, diagnostics)
4141
}
4242
is LuaCallExpr -> {
43-
callDeprecatedInspections(it, file, diagnostics)
43+
// callDeprecatedInspections(it, file, diagnostics)
4444
callExprInspections(it, file, diagnostics)
4545
}
4646
is LuaAssignStat -> {
@@ -117,9 +117,10 @@ object DiagnosticsService {
117117
}
118118

119119
private fun indexDeprecatedInspections(o: LuaIndexExpr, file: ILuaFile, diagnostics: MutableList<Diagnostic>) {
120-
val resolve = o.reference?.resolve()
121-
if ((resolve is LuaClassMethodDef && resolve.isDeprecated)
122-
|| (resolve is LuaClassField && resolve.isDeprecated)
120+
val searchContext = SearchContext.get(o.project)
121+
val res = resolve(o, searchContext)
122+
if ((res is LuaClassMethodDef && res.isDeprecated)
123+
|| (res is LuaClassField && res.isDeprecated)
123124
) {
124125
o.id?.let { id ->
125126
val diagnostic = Diagnostic()
@@ -137,11 +138,12 @@ object DiagnosticsService {
137138
if (o.parent is LuaVarList) {
138139
return
139140
}
140-
val resolve = o.reference?.resolve()
141+
val searchContext = SearchContext.get(o.project)
142+
val res = resolve(o, searchContext)
141143
val context = SearchContext.get(o.project)
142144
val prefixType = o.guessParentType(context)
143145

144-
if (prefixType !is TyUnknown && resolve == null) {
146+
if (prefixType !is TyUnknown && res == null) {
145147
o.id?.let { id ->
146148
val diagnostic = Diagnostic()
147149
diagnostic.message = "undefined property '${id.text}'"

0 commit comments

Comments
 (0)