Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
09ea4116
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
09ea4116
编写于
12月 11, 2020
作者:
I
Ilya Chernikov
提交者:
Space
2月 09, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement forced script configuration reloading API for plugins
#KT-43288 fixed
上级
2673261b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
71 addition
and
4 deletion
+71
-4
idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/DefaultScriptingSupport.kt
...idea/core/script/configuration/DefaultScriptingSupport.kt
+5
-4
idea/resources/META-INF/extensions/ide.xml
idea/resources/META-INF/extensions/ide.xml
+6
-0
idea/src/org/jetbrains/kotlin/idea/script/DefaultIdeScriptingConfigurationFacade.kt
...lin/idea/script/DefaultIdeScriptingConfigurationFacade.kt
+24
-0
libraries/scripting/intellij/src/kotlin/script/experimental/intellij/scriptConfigurationTools.kt
.../script/experimental/intellij/scriptConfigurationTools.kt
+36
-0
未找到文件。
idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/configuration/DefaultScriptingSupport.kt
浏览文件 @
09ea4116
...
...
@@ -444,20 +444,21 @@ abstract class DefaultScriptingSupportBase(val manager: CompositeScriptConfigura
/**
* Load new configuration and suggest to apply it (only if it is changed)
*/
fun
ensureUpToDatedConfigurationSuggested
(
file
:
KtFile
,
skipNotification
:
Boolean
=
false
)
{
reloadIfOutOfDate
(
file
,
skipNotification
)
fun
ensureUpToDatedConfigurationSuggested
(
file
:
KtFile
,
skipNotification
:
Boolean
=
false
,
forceSync
:
Boolean
=
false
)
{
reloadIfOutOfDate
(
file
,
skipNotification
,
forceSync
)
}
private
fun
reloadIfOutOfDate
(
file
:
KtFile
,
skipNotification
:
Boolean
=
false
)
{
private
fun
reloadIfOutOfDate
(
file
:
KtFile
,
skipNotification
:
Boolean
=
false
,
forceSync
:
Boolean
=
false
)
{
if
(!
ScriptDefinitionsManager
.
getInstance
(
project
).
isReady
())
return
manager
.
updater
.
update
{
val
virtualFile
=
file
.
originalFile
.
virtualFile
if
(
virtualFile
!=
null
)
{
val
state
=
cache
[
virtualFile
]
if
(
state
==
null
||
!
state
.
isUpToDate
(
project
,
virtualFile
,
file
))
{
if
(
state
==
null
||
forceSync
||
!
state
.
isUpToDate
(
project
,
virtualFile
,
file
))
{
reloadOutOfDateConfiguration
(
file
,
forceSync
=
forceSync
,
isFirstLoad
=
state
==
null
,
skipNotification
=
skipNotification
)
...
...
idea/resources/META-INF/extensions/ide.xml
浏览文件 @
09ea4116
...
...
@@ -38,6 +38,10 @@
interface=
"kotlin.script.experimental.intellij.ScriptDefinitionsProvider"
area=
"IDEA_PROJECT"
dynamic=
"true"
/>
<extensionPoint
qualifiedName=
"org.jetbrains.kotlin.ideScriptConfigurationControlFacade"
interface=
"kotlin.script.experimental.intellij.IdeScriptConfigurationControlFacade"
area=
"IDEA_PROJECT"
dynamic=
"true"
/>
<extensionPoint
qualifiedName=
"org.jetbrains.kotlin.syntheticScopeProviderExtension"
interface=
"org.jetbrains.kotlin.synthetic.SyntheticScopeProviderExtension"
area=
"IDEA_PROJECT"
/>
...
...
@@ -98,6 +102,8 @@
<scriptDefinitionsProvider
id=
"MainKtsScriptDefinitionSource"
implementation=
"org.jetbrains.kotlin.idea.script.MainKtsScriptDefinitionSource"
/>
<ideScriptConfigurationControlFacade
implementation=
"org.jetbrains.kotlin.idea.script.DefaultIdeScriptingConfigurationFacade"
/>
<scratchFileLanguageProvider
language=
"kotlin"
implementationClass=
"org.jetbrains.kotlin.idea.scratch.KtScratchFileLanguageProvider"
/>
<scriptAdditionalIdeaDependenciesProvider
implementation=
"org.jetbrains.kotlin.idea.scratch.ScratchAdditionalIdeaDependenciesProvider"
/>
...
...
idea/src/org/jetbrains/kotlin/idea/script/DefaultIdeScriptingConfigurationFacade.kt
0 → 100644
浏览文件 @
09ea4116
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package
org.jetbrains.kotlin.idea.script
import
com.intellij.psi.PsiFile
import
org.jetbrains.kotlin.idea.core.script.configuration.DefaultScriptingSupport
import
org.jetbrains.kotlin.psi.KtFile
import
kotlin.script.experimental.intellij.IdeScriptConfigurationControlFacade
class
DefaultIdeScriptingConfigurationFacade
:
IdeScriptConfigurationControlFacade
{
override
fun
reloadScriptConfiguration
(
scriptFile
:
PsiFile
,
updateEditorWithoutNotification
:
Boolean
)
{
(
scriptFile
as
?
KtFile
)
?:
error
(
"Should be called with script KtFile, but called with $scriptFile"
)
DefaultScriptingSupport
.
getInstance
(
scriptFile
.
project
)
.
ensureUpToDatedConfigurationSuggested
(
scriptFile
,
skipNotification
=
updateEditorWithoutNotification
,
forceSync
=
true
)
}
}
\ No newline at end of file
libraries/scripting/intellij/src/kotlin/script/experimental/intellij/scriptConfigurationTools.kt
0 → 100644
浏览文件 @
09ea4116
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package
kotlin.script.experimental.intellij
import
com.intellij.openapi.extensions.ExtensionPointName
import
com.intellij.openapi.extensions.Extensions
import
com.intellij.psi.PsiFile
/**
* Force reloading the script definition associated with the passed [scriptFile] in the Kotlin plugin
*
* [updateEditorWithoutNotification] controls whether the update of the indexes and highlighting of the script files
* based on the reloaded definition should be reloaded automatically or using notification and explicit reload action
*/
fun
reloadScriptConfiguration
(
scriptFile
:
PsiFile
,
updateEditorWithoutNotification
:
Boolean
=
false
)
{
val
extensions
=
Extensions
.
getArea
(
scriptFile
.
project
).
getExtensionPoint
(
IdeScriptConfigurationControlFacade
.
EP_NAME
).
extensions
for
(
extension
in
extensions
)
{
extension
.
reloadScriptConfiguration
(
scriptFile
,
updateEditorWithoutNotification
)
}
}
/**
* The IntelliJ extension point needed for the [reloadScriptConfiguration] function. Should not be used directly.
*/
interface
IdeScriptConfigurationControlFacade
{
fun
reloadScriptConfiguration
(
scriptFile
:
PsiFile
,
updateEditorWithoutNotification
:
Boolean
=
false
)
companion
object
{
val
EP_NAME
:
ExtensionPointName
<
IdeScriptConfigurationControlFacade
>
=
ExtensionPointName
.
create
(
"org.jetbrains.kotlin.ideScriptConfigurationControlFacade"
)
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录