Monaco Editor with Python Language Server

See original GitHub issue

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

note: I’ve also asked this on Python Language Server repo since I don’t know on which side is the issue happened…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
shoorlynecommented, Jul 28, 2018

I am also having trouble connecting Monaco language client to a “real” C++ language server other than the simple JSON language server in the example.

I guess adding an end-to-end example of Monaco editor, Monaco language client, and a “real” language server like C++ or Java working together would greatly make things a lot easier for me to follow, and maybe for other who are on this path as well.

Thanks!

2reactions
gatesncommented, Aug 2, 2018

I have an example up here of hosting a stand-alone language server over a web socket. You then just need to hook up the Monaco-languageclient examples to point at it.

https://github.com/palantir/python-jsonrpc-server/blob/develop/examples/langserver_ext.py

On 28 Jul 2018, at 16:42, shoorlyne notifications@github.com wrote:

Yup, I have tried that too. The UX is superb due to it being pure browse.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Monaco Editor - add Python language server - Stack Overflow
I'm trying to add support for intellisense for Python in Monaco Editor. All the examples I found involve using a Python Language Server...
Read more >
Language Server Protocol (Adding Support for Multiple ...
Monaco Editor is a powerful web-based editor written in JavaScript that powers the almighty Visual Studio Code. We will be using the monaco- ......
Read more >
Monaco Editor
The Monaco Editor is the code editor that powers VS Code. ... Find more information at the Monaco Editor repo. ... Supports all...
Read more >
Integrating TextX and Monaco – A Non-Tutorial - Strumenta
Monaco is the editor component of Microsoft Visual Studio Code, or VSCode for ... a Python library, with a Web client, using a...
Read more >
Language Server
Language Maintainer Repository Ada AdaCore github.com/AdaCore/ada_language_server ANTLR Ken Domino github.com/kaby76/AntlrVSIX Apache Camel Camel Tooling github.com/camel‑tooling/camel‑language‑server
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found