Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
5c245f31
Commit
5c245f31
authored
7 years ago
by
Nicolay Mitropolsky
Browse files
Options
Download
Email Patches
Plain Diff
Uast: `findPlugin` workaround for KT-18054
parent
38f189bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uast/uast-common/src/org/jetbrains/uast/UastContext.kt
+5
-1
uast/uast-common/src/org/jetbrains/uast/UastContext.kt
with
5 additions
and
1 deletion
+5
-1
uast/uast-common/src/org/jetbrains/uast/UastContext.kt
+
5
-
1
View file @
5c245f31
...
...
@@ -42,7 +42,11 @@ class UastContext(val project: Project) : UastLanguagePlugin {
get
()
=
UastLanguagePlugin
.
getInstances
()
fun
findPlugin
(
element
:
PsiElement
):
UastLanguagePlugin
?
{
val
language
=
(
element
.
containingFile
?:
element
).
language
// because sometimes java elements are used in another files (see Drools)
// we searching for plugin for file because sometimes java elements are used in another languages (see Drools)
val
containingFile
=
element
.
containingFile
?.
takeIf
{
it
!
is
PsiCompiledFile
// Dont trust compiled files because of KT-18054
}
val
language
=
(
containingFile
?:
element
).
language
return
languagePlugins
.
firstOrNull
{
it
.
language
==
language
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment