Keyword completion: add 'fun' after 'suspend' (KT-29038)
#KT-29038 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
fd262bcd8d
commit
dfd3947856
@@ -63,7 +63,8 @@ object KeywordCompletion {
|
|||||||
ANNOTATION_KEYWORD to CLASS_KEYWORD,
|
ANNOTATION_KEYWORD to CLASS_KEYWORD,
|
||||||
SEALED_KEYWORD to CLASS_KEYWORD,
|
SEALED_KEYWORD to CLASS_KEYWORD,
|
||||||
LATEINIT_KEYWORD to VAR_KEYWORD,
|
LATEINIT_KEYWORD to VAR_KEYWORD,
|
||||||
CONST_KEYWORD to VAL_KEYWORD
|
CONST_KEYWORD to VAL_KEYWORD,
|
||||||
|
SUSPEND_KEYWORD to FUN_KEYWORD
|
||||||
)
|
)
|
||||||
|
|
||||||
private val KEYWORD_CONSTRUCTS = mapOf<KtKeywordToken, String>(
|
private val KEYWORD_CONSTRUCTS = mapOf<KtKeywordToken, String>(
|
||||||
@@ -99,7 +100,10 @@ object KeywordCompletion {
|
|||||||
for (keywordToken in ALL_KEYWORDS) {
|
for (keywordToken in ALL_KEYWORDS) {
|
||||||
var keyword = keywordToken.value
|
var keyword = keywordToken.value
|
||||||
|
|
||||||
val nextKeyword = COMPOUND_KEYWORDS[keywordToken]
|
val nextKeyword = when {
|
||||||
|
keywordToken == SUSPEND_KEYWORD && ((position.containingFile as? KtFile)?.isScript() == true) -> null
|
||||||
|
else -> COMPOUND_KEYWORDS[keywordToken]
|
||||||
|
}
|
||||||
var applicableAsCompound = false
|
var applicableAsCompound = false
|
||||||
if (nextKeyword != null) {
|
if (nextKeyword != null) {
|
||||||
fun PsiElement.isSpace() = this is PsiWhiteSpace && '\n' !in getText()
|
fun PsiElement.isSpace() = this is PsiWhiteSpace && '\n' !in getText()
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class MouseMovedEventArgs
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ class AfterClasses {
|
|||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -41,6 +41,6 @@ class B {
|
|||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: annotation class AfterClasses_LangLevel11
|
// EXIST: annotation class AfterClasses_LangLevel11
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// NOTHING_ELSE
|
// NOTHING_ELSE
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ class A {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ var a : Int
|
|||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: annotation class GlobalPropertyAccessors
|
// EXIST: annotation class GlobalPropertyAccessors
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ annotation class Test {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class Test {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ class TestClass {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ enum class Test {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: fun
|
// EXIST: fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ fun foo() {
|
|||||||
val test : <caret>
|
val test : <caret>
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// NOTHING_ELSE
|
// NOTHING_ELSE
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ interface Test {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ object Test {
|
|||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ package Test
|
|||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: annotation class InTopScopeAfterPackage
|
// EXIST: annotation class InTopScopeAfterPackage
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
val a : <caret>
|
val a : <caret>
|
||||||
|
|
||||||
|
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// NOTHING_ELSE
|
// NOTHING_ELSE
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Some {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Some {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Some {
|
|||||||
// EXIST: tailrec
|
// EXIST: tailrec
|
||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class Su() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
|
|
||||||
/* TODO: items below are not valid here */
|
/* TODO: items below are not valid here */
|
||||||
// EXIST: class
|
// EXIST: class
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class Su() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
|
|
||||||
/* TODO: items below are not valid here */
|
/* TODO: items below are not valid here */
|
||||||
// EXIST: class
|
// EXIST: class
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: annotation class TopScope
|
// EXIST: annotation class TopScope
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@
|
|||||||
// EXIST: external
|
// EXIST: external
|
||||||
// EXIST: annotation class
|
// EXIST: annotation class
|
||||||
// EXIST: const val
|
// EXIST: const val
|
||||||
// EXIST: suspend
|
// EXIST: suspend fun
|
||||||
// EXIST: typealias
|
// EXIST: typealias
|
||||||
// EXIST: expect
|
// EXIST: expect
|
||||||
// EXIST: actual
|
// EXIST: actual
|
||||||
|
|||||||
Reference in New Issue
Block a user