Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions intellij-lsp/src/com/github/gtache/lsp/PluginMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,23 @@ object PluginMain {
if (forced == null) {
val forcedDef = forcedAssociations.get((uri, pUri)).orNull
if (forcedDef == null) {
var connected: Boolean = false;
extToServerDefinition.get(ext).foreach(s => {
val wrapper = getWrapperFor(ext, editor, s)
if (wrapper != null) {
LOG.info("Adding file " + file.getName)
wrapper.connect(editor)
connected = true
}
})

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is probably a if (!connected) missing here

// if not connected try with full file name, may the extention is a specific file name.
val fname = file.getName
extToServerDefinition.get(fname).foreach(s => {
val wrapper = getWrapperFor(fname, editor, s)
if (wrapper != null) {
LOG.info("Adding file [Full File Name Mode] " + file.getName)
wrapper.connect(editor)
}
})
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object RawCommandServerDefinition extends UserConfigurableServerDefinitionObject
if (arr.head == typ) {
val arrTail = arr.tail
if (arrTail.length > 1) {
RawCommandServerDefinition(arrTail.head, Utils.parseArgs(arrTail.tail))
new RawCommandServerDefinition(arrTail.head, Utils.parseArgs(arrTail.tail))
} else {
null
}
Expand All @@ -33,10 +33,14 @@ object RawCommandServerDefinition extends UserConfigurableServerDefinitionObject
* @param ext The extension
* @param command The command to run
*/
case class RawCommandServerDefinition(ext: String, command: Array[String]) extends CommandServerDefinition {
case class RawCommandServerDefinition(langId: String, ext: String, command: Array[String]) extends CommandServerDefinition {

import RawCommandServerDefinition.typ

def this(ext: String, command: Array[String]) = this(ext, ext, command)

override def id: String = langId

/**
* @return The array corresponding to the server definition
*/
Expand All @@ -45,7 +49,7 @@ case class RawCommandServerDefinition(ext: String, command: Array[String]) exten
override def toString: String = typ + " : " + command.mkString(" ")

override def equals(obj: scala.Any): Boolean = obj match {
case RawCommandServerDefinition(ext1, commands1) =>
case RawCommandServerDefinition(langId1, ext1, commands1) =>
ext == ext1 && command.toSeq == commands1.toSeq
case _ => false
}
Expand Down