@@ -24,10 +24,7 @@ import com.tang.intellij.lua.ty.hasVarargs
2424import com.tang.lsp.*
2525import com.tang.vscode.RenderRange
2626import com.tang.vscode.diagnostics.DiagnosticsService
27- import org.eclipse.lsp4j.Diagnostic
28- import org.eclipse.lsp4j.DidChangeTextDocumentParams
29- import org.eclipse.lsp4j.InlayHint
30- import org.eclipse.lsp4j.InlayHintKind
27+ import org.eclipse.lsp4j.*
3128import org.eclipse.lsp4j.jsonrpc.CancelChecker
3229import org.eclipse.lsp4j.jsonrpc.messages.Either
3330import java.util.concurrent.locks.ReentrantReadWriteLock
@@ -259,7 +256,25 @@ class LuaFile(override val uri: FileURI) : VirtualFileBase(uri), ILuaFile, Virtu
259256 var fchild = funcBody.firstChild
260257 while (fchild != funcBody.lastChild) {
261258 if (fchild.text == " )" ) {
262- overrideHints.add(RenderRange (fchild.textRange.toRange(file), null ))
259+ // var location: Location? = null
260+ // val resolve = member.reference?.resolve()
261+ // if (resolve != null) {
262+ // val sourceFile = resolve.containingFile?.virtualFile as? LuaFile
263+ // val range = resolve.nameRange
264+ // if (range != null && sourceFile != null)
265+ // location = Location(
266+ // sourceFile.uri.toString(),
267+ // range.toRange(sourceFile)
268+ // )
269+ //
270+ // }
271+ overrideHints.add(
272+ RenderRange (
273+ fchild.textRange.toRange(file),
274+ " override "
275+ )
276+ )
277+
263278 return @processSuperClass true
264279 }
265280
@@ -383,12 +398,24 @@ class LuaFile(override val uri: FileURI) : VirtualFileBase(uri), ILuaFile, Virtu
383398 for (localHint in localHints) {
384399 val hint = InlayHint (localHint.range.end, Either .forLeft(" :${localHint.hint} " ))
385400 hint.kind = InlayHintKind .Type
401+ hint.paddingLeft = true
386402 inlayHints.add(hint)
387403 }
388404 }
389405 if (overrideHints.isNotEmpty()) {
390406 for (overrideHint in overrideHints) {
391- inlayHints.add(InlayHint (overrideHint.range.end, Either .forLeft(" override " )))
407+ if (overrideHint.location == null ) {
408+ val hint = InlayHint (overrideHint.range.end, Either .forLeft(overrideHint.hint))
409+ hint.paddingLeft = true
410+ inlayHints.add(hint)
411+ }
412+ else {
413+ val hintPart = InlayHintLabelPart (overrideHint.hint)
414+ hintPart.location = overrideHint.location
415+ val hint = InlayHint (overrideHint.range.end, Either .forRight(listOf (hintPart)))
416+ hint.paddingLeft = true
417+ inlayHints.add(hint)
418+ }
392419 }
393420 }
394421 return inlayHints
0 commit comments