Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package co.huggingface.llmintellij.lsp;

import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.OSProcessHandler;
import com.intellij.util.io.BaseOutputReader;
import com.intellij.util.io.BaseOutputReader.Options;
import org.jetbrains.annotations.NotNull;


class LLMOsProcessHandler extends OSProcessHandler {
public LLMOsProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
super(commandLine);
}

protected @NotNull Options readerOptions() {
return BaseOutputReader.Options.forMostlySilentProcess();
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
package co.huggingface.llmintellij.lsp

import co.huggingface.llmintellij.LlmSettingsState
import com.intellij.execution.ExecutionException
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.execution.process.OSProcessHandler
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.lsp.api.ProjectWideLspServerDescriptor
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread
import io.ktor.util.*
import org.eclipse.lsp4j.services.LanguageServer
import java.io.File

class LlmLsLspServerDescriptor(project: Project) : ProjectWideLspServerDescriptor(project, "LlmLs") {
private val logger = Logger.getInstance("llmLsLspServerDescriptor")

@RequiresBackgroundThread
@Throws(ExecutionException::class)
override fun startServerProcess(): OSProcessHandler {
val startingCommandLine = createCommandLine()
LOG.info("$this: starting LSP server: $startingCommandLine")
return LLMOsProcessHandler(startingCommandLine)
}

override fun isSupportedFile(file: VirtualFile) = true

override fun createCommandLine(): GeneralCommandLine {
Expand Down