Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #57 from gtache/1.5.1
Browse files Browse the repository at this point in the history
1.5.1
  • Loading branch information
gtache authored Feb 14, 2019
2 parents bff1fd6 + d6a9675 commit 56e9f7e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 54 deletions.
4 changes: 4 additions & 0 deletions intellij-lsp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ intellij {
pluginName 'LSP Support'
}

patchPluginXml {
untilBuild '2018.3'
}

dependencies {
compile group: 'org.eclipse.lsp4j', name: 'org.eclipse.lsp4j', version: '0.6.0'
compile group: 'io.get-coursier', name: 'coursier_2.12', version: '1.0.3'
Expand Down
17 changes: 4 additions & 13 deletions intellij-lsp/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
<idea-plugin>
<id>com.github.gtache.lsp</id>
<name>LSP Support</name>
<version>1.5.0</version>
<version>1.5.1</version>
<vendor email="[email protected]" url="https://github.com/gtache">gtache</vendor>

<description>Adds LSP (Language Server Protocol) support for IntelliJ</description>

<change-notes>
<![CDATA[
-Updates to lsp4j 0.6.0
-Adds possibility to manually link files to a specific server
-Adds setting to always send requests
-Improves go to with ctrl-click
-Fixes Find Usages with ctrl-click
-Fixes exception when no references found
-Fixes exception when a position is bigger than the line length
-Fixes missing "Show reformat file dialog" and "Reformat code" texts in the menu
-Fixes closing an editor while server is starting not being registered
-Fixes mix of plain text and markup for hover being displayed incorrectly
-Better handling of opened editors at startup
-Potential fix for diagnostic highlights not being cleared
-Fixes error when using LinkToServer with shortcut
-Fixes missing diagnostics when codeAction is unavailable
-Fixes missing code completions
]]>
</change-notes>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ import com.github.gtache.lsp.settings.gui.ComboCheckboxDialog
import com.github.gtache.lsp.utils.ApplicationUtils.computableWriteAction
import com.github.gtache.lsp.utils.FileUtils
import com.intellij.openapi.actionSystem.{ActionPlaces, AnActionEvent, CommonDataKeys}
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.fileEditor.{FileDocumentManager, FileEditorManager, OpenFileDescriptor}
import com.intellij.openapi.project.{DumbAwareAction, Project}
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.vfs.LocalFileSystem

class LSPLinkToServerAction extends DumbAwareAction {
private val LOG: Logger = Logger.getInstance(classOf[LSPLinkToServerAction])

override def actionPerformed(anActionEvent: AnActionEvent): Unit = {
var editors: Array[Editor] = Array()
val project: Project = anActionEvent.getDataContext.getData(CommonDataKeys.PROJECT)
Expand All @@ -32,6 +35,9 @@ class LSPLinkToServerAction extends DumbAwareAction {
case ActionPlaces.PROJECT_VIEW_POPUP =>
val virtualFiles = anActionEvent.getDataContext.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)
editors = openClosedEditors(virtualFiles.map(v => FileUtils.VFSToURI(v)), project)
case _ =>
editors = Array(anActionEvent.getDataContext.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE))
LOG.warn("Unknown place : " + anActionEvent.getPlace)
}
val allEditors = editors.filter(e => e != null).partition(e => LanguageServerWrapperImpl.forEditor(e).isEmpty)
editors = allEditors._1 ++ allEditors._2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.util.concurrent.{CompletableFuture, FutureTask}

import com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapper
import com.github.gtache.lsp.editor.EditorEventManager
import com.github.gtache.lsp.requests.{SemanticHighlightingHandler, WorkspaceEditHandler}
import com.github.gtache.lsp.requests.WorkspaceEditHandler
import com.github.gtache.lsp.utils.{ApplicationUtils, FileUtils}
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.Logger
Expand Down Expand Up @@ -107,8 +107,4 @@ class LanguageClientImpl extends LanguageClient {
LOG.warn("Unknown message type for " + message)
}
}

override def semanticHighlighting(params: SemanticHighlightingParams): Unit = {
SemanticHighlightingHandler.handlePush(params)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class LSPInspection extends LocalInspectionTool {
}
val element = LSPPsiElement(name, m.editor.getProject, start, end, file)
val codeActionResult = m.codeAction(element)
if (codeActionResult != null) {
val (commandsE, codeActionsE) = codeActionResult.filter(e => e != null && (e.isLeft || e.isRight)).partition(e => e.isLeft)
val commands = commandsE.map(e => e.getLeft).map(c => new LSPCommandFix(uri, c))
val codeActions = codeActionsE.map(e => e.getRight).map(c => new LSPCodeActionFix(uri, c))
manager.createProblemDescriptor(element, null.asInstanceOf[TextRange], diagnostic.getMessage, severity, isOnTheFly,
(commands ++ codeActions).toArray: _*)
} else null
val fixes = if (codeActionResult != null) {
val (commandsE, codeActionsE) = codeActionResult.filter(e => e != null && (e.isLeft || e.isRight)).partition(e => e.isLeft)
val commands = commandsE.map(e => e.getLeft).map(c => new LSPCommandFix(uri, c))
val codeActions = codeActionsE.map(e => e.getRight).map(c => new LSPCodeActionFix(uri, c))
(commands ++ codeActions).toArray
} else null
manager.createProblemDescriptor(element, null.asInstanceOf[TextRange], diagnostic.getMessage, severity, isOnTheFly, fixes: _*)
} else null
}.toArray.filter(d => d != null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,33 +316,37 @@ class EditorEventManager(val editor: Editor, val mouseListener: EditorMouseListe
})*/
if (textEdit != null) {
if (addTextEdits != null) {
lookupElementBuilder = LookupElementBuilder.create("")
lookupElementBuilder = LookupElementBuilder.create(presentableText, "")
.withInsertHandler((context: InsertionContext, item: LookupElement) => {
context.commitDocument()
invokeLater(() => {
applyEdit(edits = addTextEdits.asScala :+ textEdit, name = "Completion : " + label)
if (command != null) executeCommands(Iterable(command))
})
})
.withLookupString(presentableText)
} else {
lookupElementBuilder = LookupElementBuilder.create("")
lookupElementBuilder = LookupElementBuilder.create(presentableText, "")
.withInsertHandler((context: InsertionContext, item: LookupElement) => {
context.commitDocument()
invokeLater(() => {
applyEdit(edits = Seq(textEdit), name = "Completion : " + label)
if (command != null) executeCommands(Iterable(command))
editor.getCaretModel.moveCaretRelatively(textEdit.getNewText.length,0,false,false,true)
})
})
.withLookupString(presentableText)
}
} else if (addTextEdits != null) {
lookupElementBuilder = LookupElementBuilder.create("")
lookupElementBuilder = LookupElementBuilder.create(presentableText, "")
.withInsertHandler((context: InsertionContext, item: LookupElement) => {
context.commitDocument()
invokeLater(() => {
applyEdit(edits = addTextEdits.asScala, name = "Completion : " + label)
if (command != null) executeCommands(Iterable(command))
})
})
.withLookupString(presentableText)
} else {
lookupElementBuilder = LookupElementBuilder.create(if (insertText != null && insertText != "") insertText else label)
if (command != null) lookupElementBuilder = lookupElementBuilder.withInsertHandler((context: InsertionContext, item: LookupElement) => {
Expand Down

This file was deleted.

0 comments on commit 56e9f7e

Please sign in to comment.