Skip to content

Commit

Permalink
fix(lsp): if a workspace contains nested folders, only use the outerm…
Browse files Browse the repository at this point in the history
…ost one
  • Loading branch information
mjossdev committed May 5, 2023
1 parent 65fb45f commit 1bbc85a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import tools.samt.common.*
import java.io.Closeable
import java.util.concurrent.CompletableFuture
import java.util.logging.Logger
import kotlin.io.path.Path
import kotlin.system.exitProcess

class SamtLanguageServer : LanguageServer, LanguageClientAware, Closeable {
Expand Down Expand Up @@ -52,9 +53,11 @@ class SamtLanguageServer : LanguageServer, LanguageClientAware, Closeable {
}

private fun buildSamtModel(params: InitializeParams) {
params.workspaceFolders.forEach {
val path = it.uri.uriToPath()
workspaces[path] = buildWorkspace(path)
val folders = params.workspaceFolders.map { it.uri.uriToPath() }
for (folder in folders) {
// if the folder is contained within another folder ignore it
if (folders.any { folder != it && Path(folder).startsWith(it) }) continue
workspaces[folder] = buildWorkspace(folder)
}
}

Expand Down

0 comments on commit 1bbc85a

Please sign in to comment.