Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve coverage #202

Merged
merged 28 commits into from
Feb 20, 2020
Merged

improve coverage #202

merged 28 commits into from
Feb 20, 2020

Conversation

randy3k
Copy link
Member

@randy3k randy3k commented Feb 10, 2020

@renkun-ken
Copy link
Member

I'm also interested in writing the test cases. Would you mind I push to this branch directly?

@randy3k
Copy link
Member Author

randy3k commented Feb 17, 2020

No problem. I don’t have time to work on it lately.

@renkun-ken
Copy link
Member

I tried adding test cases for code section symbols but I'm not sure where to specify client capabilities to make the testing language client to support hierarchicalDocumentSymbolSupport. I tried the following

    client <- language_client()
    client$ClientCapabilities <- list(
        textDocument = list(
            documentSymbol = list(
                hierarchicalDocumentSymbolSupport = TRUE
            )
        )
    )

but it does not seem to work as document_symbol_reply still gets self$ClientCapabilities = NULL.

@randy3k
Copy link
Member Author

randy3k commented Feb 18, 2020

The information for ClientCapabilities is sent when language_client is executed. You will need to set ClientCapabilities in the initialize function at

self$diagnostics <- collections::Dict()

@randy3k
Copy link
Member Author

randy3k commented Feb 18, 2020

My bad, the code was already there

self$ClientCapabilities <- capabilities

@renkun-ken
Copy link
Member

Thanks! Now new test cases are added to all providers listed.

@randy3k
Copy link
Member Author

randy3k commented Feb 18, 2020

Wow, amazing job. With the tests, I guess we are already for the next release.

@renkun-ken

This comment has been minimized.

@renkun-ken
Copy link
Member

Test cases for Rmarkdown are divided into handler test scripts and many test cases now have their Rmd version added.

@randy3k
Copy link
Member Author

randy3k commented Feb 18, 2020

👍

By the way, I don't understand why travis/push fails but travis/pr does not. Each time it fails at the same test.

" data[x, y]",
"}"
))
})
Copy link
Member Author

@randy3k randy3k Feb 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails on travis/push as well as my local computer. I don't understand how we get the indented f and data.

I keep getting

handling request:  textDocument/onTypeFormatting
formatting error: <text>:1:1: unexpected '}'
1: }
    ^

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't understand how github actions tests pass...

Copy link
Member Author

@randy3k randy3k Feb 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, actually the tests in github actions actually failed, but the error was not correctly thrown.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8f0bdcf fixed the github actions tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just notice that the coverage branch is behind #209. We may rebase to latest master to resolve this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have rebased the branch onto master.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @renkun-ken. That also explains why travis/push failed but travis/pr didn't

@renkun-ken

This comment has been minimized.

@randy3k
Copy link
Member Author

randy3k commented Feb 19, 2020

Looks like some code is reverted?

language_client <- function(working_dir = getwd(), debug = FALSE, diagnostics = FALSE)

where the capabilities argument is gone?

I guess I have accidentally removed the diff when I was resolving the conflicts.

@randy3k
Copy link
Member Author

randy3k commented Feb 19, 2020

Looks like there is a path related issue in Document link provider on Windows.

@renkun-ken
Copy link
Member

Can't see the error details except for those expect lines. Do we have a way to know more details?

@randy3k
Copy link
Member Author

randy3k commented Feb 19, 2020

Perhaps we could always enable the debug setting https://github.com/REditorSupport/languageserver/blob/master/tests/testthat/helper-utils.R#L14
and dump the file if there are any errors.

@renkun-ken
Copy link
Member

Maybe I should install a Windows virtual machine to have a look at this. 😂

@randy3k
Copy link
Member Author

randy3k commented Feb 19, 2020

@renkun-ken see if the dumped log for windows would help
https://github.com/REditorSupport/languageserver/actions/runs/41699817

@randy3k
Copy link
Member Author

randy3k commented Feb 19, 2020

It doesn't have much information in the log as document_link_reply doesn't have any debug log.

@renkun-ken
Copy link
Member

I've set up a Windows virtual box and am looking into this.😂

@renkun-ken
Copy link
Member

It looks like there's something inconsistent in slash between path and uris. According to https://microsoft.github.io/language-server-protocol/specifications/specification-current/#uri, uri should only use /. However, under Windows, normalizePath() uses \\ by default while file.path() uses /, and path_to_uri does not ensure / so the resulted URI may become something like

"file:///C:%5CUsers%5CRUNNER~1%5CAppData%5CLocal%5CTemp%5CRtmpakDrf8/working_dir%5CRtmpC2WiHu%5Cfile16401a762f8e.R"

if the input path uses \\ since it is URL encoded.

@renkun-ken
Copy link
Member

renkun-ken commented Feb 19, 2020

On my Windows 10 VM, I tried to run the tests but link test always timeout, and the logging added to both document_link_reply and the tests are not triggered at all.

@renkun-ken
Copy link
Member

renkun-ken commented Feb 19, 2020

After some painful debugging on Windows 10 VM, the cause is found:

The link test cases write the following code to the temp file:

source('C:\Users\ken\AppData\Local\Temp\Rtmp6HblZk\file1b5448882fd4.R')
source('file1b5448882fd4.R')
source('non_exist_file.R')

The Windows slash in the file makes it not parse-able.

@randy3k randy3k changed the title [wip] improve coverage improve coverage Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve test coverage
2 participants