@@ -13,6 +13,7 @@ import com.tang.lsp.toRange
1313import org.eclipse.lsp4j.Diagnostic
1414import org.eclipse.lsp4j.DiagnosticSeverity
1515import org.eclipse.lsp4j.DiagnosticTag
16+ import kotlin.math.exp
1617
1718object DiagnosticsService {
1819 fun diagnosticFile (file : ILuaFile , diagnostics : MutableList <Diagnostic >) {
@@ -110,6 +111,36 @@ object DiagnosticsService {
110111 diagnostics.add(diagnostic)
111112 }
112113 }
114+
115+ if (DiagnosticsOptions .fieldValidation){
116+ if (it.parent is LuaVarList ){
117+ return @processElements true
118+ }
119+
120+ if (resolve == null ) {
121+ it.id?.let { id ->
122+ val diagnostic = Diagnostic ()
123+ diagnostic.message = " undefined property '${id.text} '"
124+ diagnostic.severity = DiagnosticSeverity .Warning
125+ diagnostic.range = id.textRange.toRange(file)
126+ diagnostics.add(diagnostic)
127+ }
128+ }
129+ }
130+ }
131+ is LuaCallExpr -> {
132+ val expr = it.expr
133+ if (expr is LuaNameExpr ) {
134+ val resolve = expr.reference?.resolve()
135+ if (resolve is LuaFuncDef && resolve.isDeprecated) {
136+ val diagnostic = Diagnostic ()
137+ diagnostic.message = " deprecated"
138+ diagnostic.severity = DiagnosticSeverity .Hint
139+ diagnostic.tags = listOf (DiagnosticTag .Deprecated )
140+ diagnostic.range = expr.textRange.toRange(file)
141+ diagnostics.add(diagnostic)
142+ }
143+ }
113144 }
114145 }
115146
0 commit comments