-
Notifications
You must be signed in to change notification settings - Fork 5.8k
KTIJ-35157 Scripts: importScripts doesn't import files - fix #3464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
| package org.jetbrains.kotlin.idea.core.script.k2.modules | ||
|
|
||
| import com.intellij.openapi.project.Project | ||
| import com.intellij.openapi.vfs.VirtualFile | ||
| import com.intellij.platform.backend.workspace.toVirtualFileUrl | ||
| import com.intellij.platform.backend.workspace.workspaceModel | ||
| import org.jetbrains.kotlin.idea.core.script.k2.configurations.DefaultKotlinScriptEntityProvider | ||
|
|
||
| class DefaultKotlinScriptDependenciesProvider : K2IdeScriptAdditionalIdeaDependenciesProvider { | ||
| override fun getRelatedModules( | ||
| file: VirtualFile, project: Project | ||
| ): List<VirtualFile> { | ||
| return DefaultKotlinScriptEntityProvider.getInstance(project).getImportedScripts(file) | ||
| } | ||
|
|
||
| override fun getRelatedLibraries( | ||
| file: VirtualFile, project: Project | ||
| ): List<KotlinScriptLibraryEntity> { | ||
| val currentSnapshot = project.workspaceModel.currentSnapshot | ||
| val index = currentSnapshot.getVirtualFileUrlIndex() | ||
| val manager = project.workspaceModel.getVirtualFileUrlManager() | ||
|
|
||
| return getRelatedModules(file, project).flatMap { | ||
| index.findEntitiesByUrl(it.toVirtualFileUrl(manager)) | ||
| }.filterIsInstance<KotlinScriptEntity>().flatMap { it.dependencies.mapNotNull { currentSnapshot.resolve(it) } } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated
|
||
| } | ||


Uh oh!
There was an error while loading. Please reload this page.