Skip to content

Commit 2f49e04

Browse files
committed
Fix null doc_string in signature
1 parent 2564649 commit 2f49e04

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

R/signature.R

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ signature_reply <- function(id, uri, workspace, document, point) {
5151
if (doc_line1 < func_line1) {
5252
comment <- document$content[doc_line1:(func_line1 - 1)]
5353
doc <- convert_comment_to_documentation(comment)
54+
doc_string <- NULL
55+
5456
if (is.character(doc)) {
5557
doc_string <- doc
5658
} else if (is.list(doc)) {
@@ -60,6 +62,11 @@ signature_reply <- function(id, uri, workspace, document, point) {
6062
doc_string <- doc$markdown
6163
}
6264
}
65+
66+
if (is.null(doc_string)) {
67+
doc_string <- ""
68+
}
69+
6370
documentation <- list(kind = "markdown", value = doc_string)
6471
}
6572

@@ -77,12 +84,18 @@ signature_reply <- function(id, uri, workspace, document, point) {
7784
logger$info("sig: ", sig)
7885
if (!is.null(sig)) {
7986
doc <- workspace$get_documentation(result$token, result$package, isf = TRUE)
80-
doc_string <- ""
87+
doc_string <- NULL
88+
8189
if (is.character(doc)) {
8290
doc_string <- doc
8391
} else if (is.list(doc)) {
8492
doc_string <- doc$description
8593
}
94+
95+
if (is.null(doc_string)) {
96+
doc_string <- ""
97+
}
98+
8699
documentation <- list(kind = "markdown", value = doc_string)
87100

88101
SignatureInformation <- list(list(

R/utils.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ path_from_uri <- function(uri) {
103103
path
104104
}
105105

106-
107106
#' @keywords internal
108107
#' @rdname path_from_uri
109108
path_to_uri <- function(path) {

0 commit comments

Comments
 (0)