Skip to content

Commit 28ad089

Browse files
committed
refactor(java/lsp): move keyword arrays to 'keywords.kt' for better separation of concerns
1 parent 8ce7cf6 commit 28ad089

File tree

3 files changed

+85
-78
lines changed

3 files changed

+85
-78
lines changed

java/lsp/src/main/java/com/itsaky/androidide/lsp/java/actions/generators/OverrideSuperclassMethodsAction.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import com.itsaky.androidide.lsp.java.actions.BaseJavaCodeAction
2929
import com.itsaky.androidide.lsp.java.compiler.CompileTask
3030
import com.itsaky.androidide.lsp.java.compiler.CompilerProvider
3131
import com.itsaky.androidide.lsp.java.parser.ParseTask
32-
import com.itsaky.androidide.lsp.java.providers.completion.KeywordCompletionProvider.Companion.PRIMITIVE_TYPE_KEYWORDS
32+
import com.itsaky.androidide.lsp.java.providers.completion.PRIMITIVE_TYPE_KEYWORDS
3333
import com.itsaky.androidide.lsp.java.rewrite.AddImport
3434
import com.itsaky.androidide.lsp.java.utils.EditHelper
3535
import com.itsaky.androidide.lsp.java.utils.FindHelper

java/lsp/src/main/java/com/itsaky/androidide/lsp/java/providers/completion/KeywordCompletionProvider.kt

-77
Original file line numberDiff line numberDiff line change
@@ -87,81 +87,4 @@ class KeywordCompletionProvider(
8787
}
8888
throw RuntimeException("empty path")
8989
}
90-
91-
companion object {
92-
private val TOP_LEVEL_KEYWORDS =
93-
arrayOf(
94-
"package",
95-
"import",
96-
"public",
97-
"private",
98-
"protected",
99-
"abstract",
100-
"class",
101-
"interface",
102-
"@interface",
103-
"extends",
104-
"implements"
105-
)
106-
val PRIMITIVE_TYPE_KEYWORDS =
107-
arrayOf(
108-
"byte",
109-
"short",
110-
"int",
111-
"long",
112-
"float",
113-
"double",
114-
"boolean",
115-
"char"
116-
)
117-
private val CLASS_BODY_KEYWORDS =
118-
arrayOf(
119-
*PRIMITIVE_TYPE_KEYWORDS,
120-
"public",
121-
"private",
122-
"protected",
123-
"static",
124-
"final",
125-
"native",
126-
"synchronized",
127-
"abstract",
128-
"default",
129-
"class",
130-
"interface",
131-
"void",
132-
"true",
133-
"false",
134-
"null"
135-
)
136-
private val METHOD_BODY_KEYWORDS =
137-
arrayOf(
138-
*PRIMITIVE_TYPE_KEYWORDS,
139-
"new",
140-
"assert",
141-
"try",
142-
"catch",
143-
"finally",
144-
"throw",
145-
"return",
146-
"break",
147-
"case",
148-
"continue",
149-
"default",
150-
"do",
151-
"while",
152-
"for",
153-
"switch",
154-
"if",
155-
"else",
156-
"instanceof",
157-
"var",
158-
"final",
159-
"class",
160-
"void",
161-
"synchronized",
162-
"true",
163-
"false",
164-
"null"
165-
)
166-
}
16790
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* This file is part of AndroidIDE.
3+
*
4+
* AndroidIDE is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* AndroidIDE is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.itsaky.androidide.lsp.java.providers.completion
19+
20+
val TOP_LEVEL_KEYWORDS =
21+
arrayOf(
22+
"package",
23+
"import",
24+
"public",
25+
"private",
26+
"protected",
27+
"abstract",
28+
"class",
29+
"interface",
30+
"@interface",
31+
"extends",
32+
"implements",
33+
)
34+
val PRIMITIVE_TYPE_KEYWORDS =
35+
arrayOf("byte", "short", "int", "long", "float", "double", "boolean", "char")
36+
val CLASS_BODY_KEYWORDS =
37+
arrayOf(
38+
*PRIMITIVE_TYPE_KEYWORDS,
39+
"public",
40+
"private",
41+
"protected",
42+
"static",
43+
"final",
44+
"native",
45+
"synchronized",
46+
"abstract",
47+
"default",
48+
"class",
49+
"interface",
50+
"void",
51+
"true",
52+
"false",
53+
"null",
54+
)
55+
val METHOD_BODY_KEYWORDS =
56+
arrayOf(
57+
*PRIMITIVE_TYPE_KEYWORDS,
58+
"new",
59+
"assert",
60+
"try",
61+
"catch",
62+
"finally",
63+
"throw",
64+
"return",
65+
"break",
66+
"case",
67+
"continue",
68+
"default",
69+
"do",
70+
"while",
71+
"for",
72+
"switch",
73+
"if",
74+
"else",
75+
"instanceof",
76+
"var",
77+
"final",
78+
"class",
79+
"void",
80+
"synchronized",
81+
"true",
82+
"false",
83+
"null",
84+
)

0 commit comments

Comments
 (0)