File tree Expand file tree Collapse file tree 4 files changed +14
-35
lines changed
EmmyLua-LS/src/main/kotlin/com/tang/vscode Expand file tree Collapse file tree 4 files changed +14
-35
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,13 @@ class LuaTextDocumentService(private val workspace: LuaWorkspaceService) : TextD
398398 if (range != null && sourceFile != null )
399399 list.add(Location (sourceFile.uri.toString(), range.toRange(sourceFile)))
400400 }
401+ else if (target != null ){
402+ val query = ReferencesSearch .search(target)
403+ query.forEach { ref ->
404+ val luaFile = ref.element.containingFile.virtualFile as LuaFile
405+ list.add(Location (luaFile.uri.toString(), ref.getRangeInFile(luaFile)))
406+ }
407+ }
401408 }
402409 }
403410 Either .forLeft(list)
Original file line number Diff line number Diff line change @@ -72,38 +72,6 @@ object VSCodeSettings : IVSCodeSettings {
7272 // show codeLens
7373 myShowCodeLens = path(" emmylua.codeLens" )?.asBoolean == true
7474
75- path(" emmylua.format.indentCount" )?.asInt?.let {
76- if (it > 0 ) {
77- FormattingOptions .indent = it
78- }
79- }
80-
81- path(" emmylua.format.tableLineWidth" )?.asInt?.let {
82- if (it > 0 ) {
83- FormattingOptions .tableLineWidth = it
84- }
85- }
86-
87- path(" emmylua.format.callExprAlignToFirstArg" )?.asBoolean?.let {
88- FormattingOptions .callExprAlignToFirstArg = it
89- }
90-
91- path(" emmylua.format.functionLineSpacing" )?.asInt?.let {
92- if (it > 0 ) {
93- FormattingOptions .functionSpacing = it
94- }
95- }
96-
97- path(" emmylua.format.loopLineSpacing" )?.asInt?.let {
98- if (it > 0 ) {
99- FormattingOptions .loopSpacing = it
100- }
101- }
102-
103- path(" emmylua.format.blankBeforeFirstArg" )?.asBoolean?.let {
104- FormattingOptions .blankBeforeFirstArg = it
105- }
106-
10775 path(" emmylua.hint.paramHint" )?.asBoolean?.let {
10876 LuaSettings .instance.paramHint = it
10977 }
@@ -136,7 +104,9 @@ object VSCodeSettings : IVSCodeSettings {
136104 path(" emmylua.diagnostics.defineTypeCanReceiveNilType" )?.asBoolean?.let {
137105 DiagnosticsOptions .defineTypeCanReceiveNilType = it
138106 }
139-
107+ path(" emmylua.diagnostics.fieldValidation" )?.asBoolean?.let {
108+ DiagnosticsOptions .fieldValidation = it
109+ }
140110
141111 return SettingsUpdateResult (associationChanged)
142112 }
Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ object DiagnosticsOptions {
1313 // nil 是否可以赋值给任何定义类型
1414 var defineTypeCanReceiveNilType = true
1515
16- var fieldValidation = true
16+ var fieldValidation = false
1717}
Original file line number Diff line number Diff line change @@ -116,8 +116,10 @@ object DiagnosticsService {
116116 if (it.parent is LuaVarList ){
117117 return @processElements true
118118 }
119+ val context = SearchContext .get(it.project)
120+ val prefixType = it.guessParentType(context)
119121
120- if (resolve == null ) {
122+ if (prefixType !is TyUnknown && resolve == null ) {
121123 it.id?.let { id ->
122124 val diagnostic = Diagnostic ()
123125 diagnostic.message = " undefined property '${id.text} '"
You can’t perform that action at this time.
0 commit comments