Skip to content

Conversation

@andfoy
Copy link
Contributor

@andfoy andfoy commented Mar 17, 2020

This PR normalizes path completions returned by Jedi and escapes them in order to prevent conflicts with the code snippets grammar.

Fixes spyder-ide/spyder#5519

@ccordoba12 ccordoba12 added this to the 0.31.9 milestone Mar 17, 2020
if d.type == 'path':
path = osp.normpath(d.name)
path = path.replace('\\', '\\\\')
path = path.replace('/', '\\/')
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these replacements change the way you write paths on Windows and Posix systems in the Spyder editor?

Copy link
Contributor Author

@andfoy andfoy Mar 17, 2020

Choose a reason for hiding this comment

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

They just escape forward and backward slashes in order to prevent conflicts with the LSP snippets grammar when inserting the text. We're escaping them back in Spyder as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, paths are normalized in order to preserve backward slashes in Windows and forward ones on POSIX

@ccordoba12 ccordoba12 changed the title PR: Escape Jedi path completions Escape Jedi path completions Mar 18, 2020
@ccordoba12 ccordoba12 merged commit e20bf30 into palantir:develop Mar 18, 2020
@andfoy andfoy deleted the escape_paths branch March 18, 2020 15:39
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.

Add path autocompletion to the Editor

2 participants