Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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,4 @@
{
"type" : "bugfix",
"description" : "\"@workspace cannot properly locate certain folders for certain project setup"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import com.intellij.openapi.Disposable
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.guessProjectDir
import com.intellij.openapi.vfs.VfsUtilCore
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileVisitor
Expand Down Expand Up @@ -130,7 +129,7 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
}

private fun initEncryption(): Boolean {
logger.info { "project context: init key for ${project.guessProjectDir()} on port ${encoderServer.port}" }
logger.info { "project context: init key for ${project.basePath} on port ${encoderServer.port}" }
val url = URL("http://localhost:${encoderServer.port}/initialize")
val payload = encoderServer.getEncryptionRequest()
val connection = url.openConnection() as HttpURLConnection
Expand All @@ -148,7 +147,7 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
var duration = (System.currentTimeMillis() - indexStartTime).toDouble()
logger.debug { "project context file collection time: ${duration}ms" }
logger.debug { "list of files collected: ${filesResult.files.joinToString("\n")}" }
val projectRoot = project.guessProjectDir()?.path ?: return false
val projectRoot = project.basePath ?: return false
val payload = IndexRequestPayload(filesResult.files, projectRoot, false)
val payloadJson = mapper.writeValueAsString(payload)
val encrypted = encoderServer.encrypt(payloadJson)
Expand Down Expand Up @@ -275,7 +274,7 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En
var currentTotalFileSize = 0L
val featureDevSessionContext = FeatureDevSessionContext(project)
val allFiles = mutableListOf<VirtualFile>()
project.guessProjectDir()?.let {
Copy link
Contributor

Choose a reason for hiding this comment

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

probably need tests

Copy link
Contributor Author

@leigaol leigaol Oct 17, 2024

Choose a reason for hiding this comment

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

We are making a new major LSP release in 1-2 weeks. Tests will be added as part of below PRs

#4970
#4971
#4972
#4978
#4976

project.baseDir?.let {
VfsUtilCore.visitChildrenRecursively(
it,
object : VirtualFileVisitor<Unit>(NO_FOLLOW_SYMLINKS) {
Expand Down
Loading