lsp icon indicating copy to clipboard operation
lsp copied to clipboard

dup code of 'peek-defintation' etc.

Open Shane-XB-Qian opened this issue 4 years ago • 5 comments

diff --git a/plugin/lsp.vim b/plugin/lsp.vim
index 561f14c..ff60759 100644
--- a/plugin/lsp.vim
+++ b/plugin/lsp.vim
@@ -24,25 +24,20 @@ if has('patch-8.2.4257')
   lspf.showServerCapabilities = lsp.ShowServerCapabilities
   lspf.setTraceServer = lsp.SetTraceServer
   lspf.gotoDefinition = lsp.GotoDefinition
   lspf.gotoDeclaration = lsp.GotoDeclaration
   lspf.gotoTypedef = lsp.GotoTypedef
   lspf.gotoImplementation = lsp.GotoImplementation
-  lspf.gotoDefinition = lsp.GotoDefinition
-  lspf.gotoDeclaration = lsp.GotoDeclaration
-  lspf.gotoTypedef = lsp.GotoTypedef
-  lspf.gotoImplementation = lsp.GotoImplementation
   lspf.showDiagnostics = lsp.ShowDiagnostics
   lspf.showCurrentDiag = lsp.LspShowCurrentDiag
   lspf.jumpToDiag = lsp.JumpToDiag
   lspf.jumpToDiag = lsp.JumpToDiag
   lspf.jumpToDiag = lsp.JumpToDiag
   lspf.diagHighlightEnable = lsp.DiagHighlightEnable
   lspf.diagHighlightDisable = lsp.DiagHighlightDisable
   lspf.showReferences = lsp.ShowReferences
-  lspf.showReferences = lsp.ShowReferences
   lspf.outline = lsp.Outline
   lspf.textDocFormat = lsp.TextDocFormat
   lspf.incomingCalls = lsp.IncomingCalls
   lspf.outgoingCalls = lsp.OutgoingCalls
   lspf.rename = lsp.Rename
   lspf.codeAction = lsp.CodeAction
@@ -70,25 +65,20 @@ elseif has('patch-8.2.4019')
   lspf.showServerCapabilities = lsp_import.ShowServerCapabilities
   lspf.setTraceServer = lsp_import.SetTraceServer
   lspf.gotoDefinition = lsp_import.GotoDefinition
   lspf.gotoDeclaration = lsp_import.GotoDeclaration
   lspf.gotoTypedef = lsp_import.GotoTypedef
   lspf.gotoImplementation = lsp_import.GotoImplementation
-  lspf.gotoDefinition = lsp_import.GotoDefinition
-  lspf.gotoDeclaration = lsp_import.GotoDeclaration
-  lspf.gotoTypedef = lsp_import.GotoTypedef
-  lspf.gotoImplementation = lsp_import.GotoImplementation
   lspf.showDiagnostics = lsp_import.ShowDiagnostics
   lspf.showCurrentDiag = lsp_import.LspShowCurrentDiag
   lspf.jumpToDiag = lsp_import.JumpToDiag
   lspf.jumpToDiag = lsp_import.JumpToDiag
   lspf.jumpToDiag = lsp_import.JumpToDiag
   lspf.diagHighlightEnable = lsp_import.DiagHighlightEnable
   lspf.diagHighlightDisable = lsp_import.DiagHighlightDisable
   lspf.showReferences = lsp_import.ShowReferences
-  lspf.showReferences = lsp_import.ShowReferences
   lspf.outline = lsp_import.Outline
   lspf.textDocFormat = lsp_import.TextDocFormat
   lspf.incomingCalls = lsp_import.IncomingCalls
   lspf.outgoingCalls = lsp_import.OutgoingCalls
   lspf.rename = lsp_import.Rename
   lspf.codeAction = lsp_import.CodeAction
@@ -148,25 +138,20 @@ else
   lspf.showServerCapabilities = ShowServerCapabilities
   lspf.setTraceServer = SetTraceServer
   lspf.gotoDefinition = GotoDefinition
   lspf.gotoDeclaration = GotoDeclaration
   lspf.gotoTypedef = GotoTypedef
   lspf.gotoImplementation = GotoImplementation
-  lspf.gotoDefinition = GotoDefinition
-  lspf.gotoDeclaration = GotoDeclaration
-  lspf.gotoTypedef = GotoTypedef
-  lspf.gotoImplementation = GotoImplementation
   lspf.showDiagnostics = ShowDiagnostics
   lspf.showCurrentDiag = LspShowCurrentDiag
   lspf.jumpToDiag = JumpToDiag
   lspf.jumpToDiag = JumpToDiag
   lspf.jumpToDiag = JumpToDiag
   lspf.diagHighlightEnable = DiagHighlightEnable
   lspf.diagHighlightDisable = DiagHighlightDisable
   lspf.showReferences = ShowReferences
-  lspf.showReferences = ShowReferences
   lspf.outline = Outline
   lspf.textDocFormat = TextDocFormat
   lspf.incomingCalls = IncomingCalls
   lspf.outgoingCalls = OutgoingCalls
   lspf.rename = Rename
   lspf.codeAction = CodeAction

Shane-XB-Qian avatar Feb 07 '22 16:02 Shane-XB-Qian

by the way: if the definition of a symbol was under the same buf of cur one, then the 'peek-definition' action would change the 'changelist' (try changenr() to chk), looks a bit annoyed.

Shane-XB-Qian avatar Feb 07 '22 16:02 Shane-XB-Qian

Thanks for reporting this issue. I have fixed this in 4bbddf9bf9ad42ff9f602483972bc47972061542.

I am not able to reproduce the issue with "peek-definition". The change list for the current buffer is not changed when I peek the symbol definition in the current buffer.

yegappan avatar Feb 08 '22 05:02 yegappan

diff --git a/plugin/lsp.vim b/plugin/lsp.vim
index b0c24a6..b672d6d 100644
--- a/plugin/lsp.vim
+++ b/plugin/lsp.vim
@@ -141,14 +141,12 @@ else
   lspf.gotoDeclaration = GotoDeclaration
   lspf.gotoTypedef = GotoTypedef
   lspf.gotoImplementation = GotoImplementation
   lspf.showDiagnostics = ShowDiagnostics
   lspf.showCurrentDiag = LspShowCurrentDiag
   lspf.jumpToDiag = JumpToDiag
-  lspf.jumpToDiag = JumpToDiag
-  lspf.jumpToDiag = JumpToDiag
   lspf.diagHighlightEnable = DiagHighlightEnable
   lspf.diagHighlightDisable = DiagHighlightDisable
   lspf.showReferences = ShowReferences
   lspf.showReferences = ShowReferences
   lspf.outline = Outline
   lspf.textDocFormat = TextDocFormat

there are still some dup.

Shane-XB-Qian avatar Feb 08 '22 05:02 Shane-XB-Qian

yes, buf content seems was not changed, but LspPeekDefinition made changenr() changed, and then issue u would make the buf be marked as 'modified'.

Shane-XB-Qian avatar Feb 08 '22 05:02 Shane-XB-Qian

I am able to reproduce the issue now. The undolist() function also displays the undo information. It looks like opening a file in a preview window using 'pedit', creates an undo point. I need to look into this more.

yegappan avatar Feb 08 '22 06:02 yegappan