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

completionHelper will break yaml file if it contains \r charactor #37

Closed
andxu opened this issue Jan 16, 2018 · 3 comments
Closed

completionHelper will break yaml file if it contains \r charactor #37

andxu opened this issue Jan 16, 2018 · 3 comments

Comments

@andxu
Copy link
Contributor

andxu commented Jan 16, 2018

Here is the code to repro the test

let content = "test\r\nfoo:bar\r\n";
let position = 3;
let testTextDocument = TextDocument.create("file://~/Desktop/vscode-k8s/test.yaml", "yaml", 0, content);
let res = completionHelper(testTextDocument, testTextDocument.positionAt(position), false);
console.log(JSON.stringify(res.newText));

The test has output of "test\r:\r\no:bar\r\n" (foo has been cut off first two charactors 'fo'

@rcjsuen
Copy link
Contributor

rcjsuen commented Feb 3, 2018

I can reproduce this problem but it seems to me like that function isn't really intended to be API.

Why are you calling this function instead of using the language service anyway, @andxu?

@andxu
Copy link
Contributor Author

andxu commented Feb 6, 2018

I am using the yaml language server in vscode-yaml extension, I found some completions are not right so I take a look at the code and found it is caused by \r, so I opened an issue here, and I will open a PR to fix it.

andxu added a commit to andxu/yaml-language-server that referenced this issue Mar 16, 2018
JPinkney added a commit that referenced this issue Mar 16, 2018
fix issue #37 completionHelper will break yaml file if it contains \r …
@JPinkney
Copy link
Contributor

Thanks for the PR!

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

No branches or pull requests

3 participants