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

Support non-file URIs #199

Open
dirathea opened this issue Dec 8, 2017 · 4 comments
Open

Support non-file URIs #199

dirathea opened this issue Dec 8, 2017 · 4 comments

Comments

@dirathea
Copy link

dirathea commented Dec 8, 2017

Summary

I've tried to use PYLS on Monaco Editor using Monaco Language Client with the following configuration

this.editor.setModel(monaco.editor.createModel(exampleCode, 'python', monaco.Uri.parse('inmemory://dummy.py')););
    const services = createMonacoServices(this.editor);

And everything that this blog explained.

Everything works as expected but the auto complete. When I do ctrl + space on the editor, there's only "No Suggestions." and I saw the PYLS logs error as follows

PYLS Server: 2017-12-08 09:56:21,029 UTC - ERROR - jsonrpc.manager - API Exception: {'message': "'Folder' object has no attribute 'read'", 'args': ("'Folder' object has no attribute 'read'",), 'type': 'AttributeError'}
Traceback (most recent call last):
  File "myVirtualEnv/lib/python2.7/site-packages/jsonrpc/manager.py", line 112, in _get_responses
    result = method(*request.args, **request.kwargs)
  File "myVirtualEnv/lib/python2.7/site-packages/pyls/language_server.py", line 64, in wrapped
    return func(*args, **kwargs)
  File "myVirtualEnv/lib/python2.7/site-packages/pyls/python_ls.py", line 140, in m_text_document__completion
    return self.completions(textDocument['uri'], position)
  File "myVirtualEnv/lib/python2.7/site-packages/pyls/python_ls.py", line 70, in completions
    position=position
  File "myVirtualEnv/lib/python2.7/site-packages/pyls/_utils.py", line 113, in race_hooks
    for impl, result in pool.imap_unordered(_apply, impls, chunksize=1):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 668, in next
    raise value
AttributeError: 'Folder' object has no attribute 'read'

Could you help me? is it about the monaco URI that I pass ? inmemory://dummy.py

@gatesn
Copy link
Contributor

gatesn commented Dec 9, 2017

I think there is an issue somewhere about supporting URIs that have schemes other than “file”. I suspect this is what you’re hitting. I believe the SourceGraph language server has better support for things like this right now.

https://github.com/sourcegraph/python-langserver

@gatesn gatesn changed the title Auto Complete not working when used with Monaco Editor Support non-file URIs Jan 27, 2018
@exiaohu
Copy link

exiaohu commented Apr 1, 2020

@gatesn Thanks. But the sourcegraph language server hasn't been maintained for a while. After so long, is there any workaround or speical configuration to make the pyls support non-file uri?? Or can you point out some other alternitives?

@gatesn
Copy link
Contributor

gatesn commented Apr 2, 2020

@exiaohu are you looking to use arbitrary URLs? e.g. https etc. Or are you looking for purely in-memory analysis, e.g. only things passed by didOpen will be valid

@ColinTenaguillo
Copy link

Any updates on the subject ? I am trying to make pyls work with monaco editor with inmemory scheme files, and cant find a way to have intellisense across multiple files. I would like to import methods/class from a model created in monaco editor into an other model, (import method from "inmemory://toto.py" into "inmemory://tata.py") , but pyls seems to not understand that toto.py exist while editing tata.py.

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

4 participants