Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Commit 1af0722

Browse files
committed
Only set detail if possible
1 parent 4cef2a5 commit 1af0722

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ For code changes, see [`CHANGELOG_CODE.md`][_-1].
1515

1616
* Functions, methods and constructors
1717
can now be autocompleted with parentheses.
18+
* Auto-import completions now use the source as the supporting detail.
19+
Previously the detail was "Auto-import" or a similar localized message.
1820

1921

2022
## [0.4.0] - 2024-05-15

CHANGELOG_CODE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,16 @@ For user-facing changes, see [`CHANGELOG.md`][_-1].
2323
* [The Qodana Gradle plugin][50-2] and its corresponding action
2424
[@JetBrains/qodana-action][50-3] are updated to 2024.1.5.
2525
(85c78a93)
26+
* Another conditional was added to
27+
[`CompletionSupport.createLookupElement`][50-4]
28+
to use the source of an auto-import completion as its detail.
29+
(4cef2a5d, HEAD)
2630

2731

2832
[50-1]: https://github.com/Kotlin/kotlinx-kover
2933
[50-2]: https://plugins.gradle.org/plugin/org.jetbrains.qodana
3034
[50-3]: https://github.com/JetBrains/qodana-action
35+
[50-4]: https://github.com/InSyncWithFoo/pyright-langserver-for-pycharm/blob/HEAD/src/main/kotlin/com/insyncwithfoo/pyrightls/server/CompletionSupport.kt
3136

3237

3338
## [0.4.0] - 2024-05-15

src/main/kotlin/com/insyncwithfoo/pyrightls/configuration/PathResolvingHint.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ internal data class Hint(
3636
internal fun emptyPathHint() = Hint.info(message("configurations.hint.noPathSpecified"))
3737

3838

39-
internal fun invalidPathHint() =
40-
Hint.error(message("configurations.hint.invalidPath"))
39+
internal fun invalidPathHint() = Hint.error(message("configurations.hint.invalidPath"))
4140

4241

4342
internal fun executablePathResolvingHint(path: Path) = when {

src/main/kotlin/com/insyncwithfoo/pyrightls/server/CompletionSupport.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ private fun CompletionItem.completeWithParentheses() {
3535
}
3636

3737

38-
private fun CompletionItem.useSourceAsDetail() {
38+
private fun CompletionItem.useSourceAsDetailIfPossible() {
3939
// https://github.com/microsoft/pyright/blob/0b7860b/packages/pyright-internal/src/languageService/completionProvider.ts#L932-L934
40-
detail = labelDetails.description
40+
detail = labelDetails?.description ?: ""
4141
}
4242

4343

@@ -52,7 +52,7 @@ internal class CompletionSupport(project: Project) : LspCompletionSupport() {
5252
}
5353

5454
if (item.isAutoImportCompletion) {
55-
item.useSourceAsDetail()
55+
item.useSourceAsDetailIfPossible()
5656
}
5757

5858
return super.createLookupElement(parameters, item)

0 commit comments

Comments
 (0)