Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
4ad9f486
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,发现更多精彩内容 >>
提交
4ad9f486
编写于
11月 03, 2020
作者:
D
Dmitriy Novozhilov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CMI] Cleanup code of CodeMetaInfo
上级
23c088af
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
14 deletion
+23
-14
idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/AbstractCodeMetaInfoTest.kt
...ains/kotlin/idea/codeMetaInfo/AbstractCodeMetaInfoTest.kt
+1
-1
idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/models/CodeMetaInfo.kt
...jetbrains/kotlin/idea/codeMetaInfo/models/CodeMetaInfo.kt
+18
-11
idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/renderConfigurations/AbstractCodeMetaInfoRenderConfiguration.kt
...Configurations/AbstractCodeMetaInfoRenderConfiguration.kt
+4
-2
未找到文件。
idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/AbstractCodeMetaInfoTest.kt
浏览文件 @
4ad9f486
...
...
@@ -67,7 +67,7 @@ class CodeMetaInfoTestCase(
):
List
<
CodeMetaInfo
>
{
val
tempSourceKtFile
=
PsiManager
.
getInstance
(
project
).
findFile
(
file
.
virtualFile
)
as
KtFile
val
resolutionFacade
=
tempSourceKtFile
.
getResolutionFacade
()
val
(
bindingContext
,
moduleDescriptor
)
=
resolutionFacade
.
analyzeWithAllCompilerChecks
(
listOf
(
tempSourceKtFile
))
val
(
bindingContext
,
moduleDescriptor
,
_
)
=
resolutionFacade
.
analyzeWithAllCompilerChecks
(
listOf
(
tempSourceKtFile
))
val
directives
=
KotlinTestUtils
.
parseDirectives
(
file
.
text
)
val
diagnosticsFilter
=
BaseDiagnosticsTest
.
parseDiagnosticFilterDirective
(
directives
,
allowUnderscoreUsage
=
false
)
val
diagnostics
=
CheckerTestUtil
.
getDiagnosticsIncludingSyntaxErrors
(
...
...
idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/models/CodeMetaInfo.kt
浏览文件 @
4ad9f486
...
...
@@ -29,18 +29,18 @@ interface CodeMetaInfo {
class
DiagnosticCodeMetaInfo
(
override
val
start
:
Int
,
override
val
end
:
Int
,
override
val
renderConfiguration
:
Abstract
CodeMetaInfoRenderConfiguration
,
override
val
renderConfiguration
:
Diagnostic
CodeMetaInfoRenderConfiguration
,
val
diagnostic
:
Diagnostic
)
:
CodeMetaInfo
{
override
val
platforms
:
MutableList
<
String
>
=
mutableListOf
()
override
fun
asString
()
=
renderConfiguration
.
asString
(
this
)
override
fun
asString
()
:
String
=
renderConfiguration
.
asString
(
this
)
override
fun
getTag
()
=
(
renderConfiguration
as
DiagnosticCodeMetaInfoRenderConfiguration
)
.
getTag
(
this
)
override
fun
getTag
()
:
String
=
renderConfiguration
.
getTag
(
this
)
}
class
LineMarkerCodeMetaInfo
(
override
val
renderConfiguration
:
AbstractCodeMetaInfo
RenderConfiguration
,
override
val
renderConfiguration
:
LineMarker
RenderConfiguration
,
val
lineMarker
:
LineMarkerInfo
<
*
>
)
:
CodeMetaInfo
{
override
val
start
:
Int
...
...
@@ -49,13 +49,13 @@ class LineMarkerCodeMetaInfo(
get
()
=
lineMarker
.
endOffset
override
val
platforms
:
MutableList
<
String
>
=
mutableListOf
()
override
fun
asString
()
=
renderConfiguration
.
asString
(
this
)
override
fun
asString
()
:
String
=
renderConfiguration
.
asString
(
this
)
override
fun
getTag
()
=
(
renderConfiguration
as
LineMarkerRenderConfiguration
)
.
getTag
()
override
fun
getTag
()
:
String
=
renderConfiguration
.
getTag
()
}
class
HighlightingCodeMetaInfo
(
override
val
renderConfiguration
:
AbstractCodeMetaInfo
RenderConfiguration
,
override
val
renderConfiguration
:
Highlighting
RenderConfiguration
,
val
highlightingInfo
:
HighlightInfo
)
:
CodeMetaInfo
{
override
val
start
:
Int
...
...
@@ -64,9 +64,9 @@ class HighlightingCodeMetaInfo(
get
()
=
highlightingInfo
.
endOffset
override
val
platforms
:
MutableList
<
String
>
=
mutableListOf
()
override
fun
asString
()
=
renderConfiguration
.
asString
(
this
)
override
fun
asString
()
:
String
=
renderConfiguration
.
asString
(
this
)
override
fun
getTag
()
=
(
renderConfiguration
as
HighlightingRenderConfiguration
)
.
getTag
()
override
fun
getTag
()
:
String
=
renderConfiguration
.
getTag
()
}
class
ParsedCodeMetaInfo
(
...
...
@@ -77,14 +77,21 @@ class ParsedCodeMetaInfo(
)
:
CodeMetaInfo
{
override
val
renderConfiguration
=
object
:
AbstractCodeMetaInfoRenderConfiguration
(
false
)
{}
override
fun
asString
()
=
renderConfiguration
.
asString
(
this
)
override
fun
asString
():
String
=
renderConfiguration
.
asString
(
this
)
override
fun
getTag
():
String
=
tag
override
fun
equals
(
other
:
Any
?):
Boolean
{
if
(
other
==
null
||
other
!
is
CodeMetaInfo
)
return
false
return
this
.
tag
==
other
.
getTag
()
&&
this
.
start
==
other
.
start
&&
this
.
end
==
other
.
end
}
override
fun
getTag
()
=
tag
override
fun
hashCode
():
Int
{
var
result
=
start
result
=
31
*
result
+
end
result
=
31
*
result
+
tag
.
hashCode
()
return
result
}
}
fun
createCodeMetaInfo
(
obj
:
Any
,
renderConfiguration
:
AbstractCodeMetaInfoRenderConfiguration
):
List
<
CodeMetaInfo
>
{
...
...
idea/tests/org/jetbrains/kotlin/idea/codeMetaInfo/renderConfigurations/AbstractCodeMetaInfoRenderConfiguration.kt
浏览文件 @
4ad9f486
...
...
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.idea.codeMetaInfo.models.LineMarkerCodeMetaInfo
abstract
class
AbstractCodeMetaInfoRenderConfiguration
(
var
renderParams
:
Boolean
=
true
)
{
private
val
clickOrPressRegex
=
"Click or press (.*)to navigate"
.
toRegex
()
//We have different hotkeys on different platforms
private
val
clickOrPressRegex
=
"Click or press (.*)to navigate"
.
toRegex
()
//
We have different hotkeys on different platforms
open
fun
asString
(
codeMetaInfo
:
CodeMetaInfo
)
=
codeMetaInfo
.
getTag
()
+
getPlatformsString
(
codeMetaInfo
)
open
fun
getAdditionalParams
(
codeMetaInfo
:
CodeMetaInfo
)
=
""
...
...
@@ -62,6 +62,8 @@ open class DiagnosticCodeMetaInfoRenderConfiguration(
private
fun
getParamsString
(
codeMetaInfo
:
DiagnosticCodeMetaInfo
):
String
{
if
(!
renderParams
)
return
""
val
params
=
mutableListOf
<
String
>()
@Suppress
(
"UNCHECKED_CAST"
)
val
renderer
=
when
(
codeMetaInfo
.
diagnostic
.
factory
)
{
is
DebugInfoDiagnosticFactory1
->
DiagnosticWithParameters1Renderer
(
"{0}"
,
...
...
@@ -137,4 +139,4 @@ open class HighlightingRenderConfiguration(
return
if
(
paramsString
.
isEmpty
())
""
else
"(\"$paramsString\")"
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录