-
Notifications
You must be signed in to change notification settings - Fork 78
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
Integrate Python Language Server to Monaco Editor (Closes #1908, #571) #1910
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. I read through the code and provided some feedback. I still have to test it more thoroughly but figured I would provide my initial feedback first and then post any other comments after playing with it more.
TextEditorWidget.prototype._initializeLanguageClient = function () { | ||
this.languageClient = new DeepforgeLanguageClient( | ||
this.editor, | ||
`${LANGAUGE_SERVER_HOST}/${this.language}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LANGAUGE
-> LANGUAGE
config/config.extensions.js
Outdated
config.extensions.languageServers = { | ||
host: process.env.DEEPFORGE_LANGUAGE_SERVER_HOST, | ||
servers: getAvailableLanguageServers(), | ||
workspaceURIs: getWorkspaceURIs(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at how this is used, maybe this should be called rootURIs
or rootWorkspaceURIs
? When I first read it, I was concerned that all users may be sharing the same workspace (which I don't think will be an issue).
environment.worker.yml
Outdated
@@ -6,3 +6,4 @@ dependencies: | |||
- matplotlib==3.2.2 | |||
- simplejson | |||
- plotly | |||
- python-language-server==0.25.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
'./lib/reconnecting-websocket.min', | ||
], function ( | ||
vscodeWSJSONRpc, | ||
LangaugeClient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Langauge
-> Language
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad on the typos. Sorry.
config/config.extensions.js
Outdated
|
||
const SERVERS_YML = path.join(__dirname, '..', 'language-servers.yml'); | ||
|
||
function getAvailableLanguageServers () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little wary about this. It seems to be assuming that any servers defined in language-servers.yml
are available but since that file is checked in to git, it seems likely that this will end up with invalid language servers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. can it be solved by moving language-servers.yml
to the deployment directory and using the config in production mode only?
@@ -23,6 +27,18 @@ define([ | |||
MonacoLanguages = JSON.parse(MonacoLanguages); | |||
|
|||
const AVAILABLE_KEYBINDINGS = ['default', 'vim']; | |||
const LANGAUGE_SERVER_HOST = gmeConfig.extensions.languageServers.host || getDefaultServerURL(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that we should have a default hard coded here. I was imagining that, if no language server is specified in the config, it will run without any language servers enabled (rather than assuming it is running on port 5000). Maybe this is what you were referring to when we were talking earlier. If so, my bad - I didn't realize you were referring to hardcoding the port here.
Since language servers are not required for use, it should proceed without one if none are specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed will change it to not use language servers if no host name available.
I have changed this PR to use microsoft's python language server. This still needs some changes to the TextEditorWidget code. |
…ws-proxy; minor fixes to the TextEditorWidget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple little comments. I am spinning it up now and will comment with any other issues I encounter!
.deployment/README.md
Outdated
@@ -5,9 +5,13 @@ The script `deploy-deepforge` is used for standard deployment of deepforge using | |||
|
|||
Additionally, this contains a file with customizations to the standard docker-compose.yml file which allows us to modify the entrypoint and install a version of tensorflow [compatible with the CPU of the deployment machine](https://github.com/deepforge-dev/deepforge/issues/1561). | |||
|
|||
The deployment is updated by first creating the custom docker compose file using [yaml-merge](https://github.com/alexlafroscia/yaml-merge): | |||
Moreover, we also a proxy server with that spins up different language servers that we provide for | |||
intelligent syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like some odd line breaking...
.deployment/README.md
Outdated
The deployment is updated by first creating the custom docker compose file using [yaml-merge](https://github.com/alexlafroscia/yaml-merge): | ||
Moreover, we also a proxy server with that spins up different language servers that we provide for | ||
intelligent syntax | ||
highlighting in deepforge's browser. For more information checkout the language server's docker [file](../docker/Dockerfile.langservers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"in deepforge's browser" -> "in DeepForge"
utils/languageServers.json
Outdated
@@ -0,0 +1,18 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in utils? It seems deployment specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and only used by docker files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. This could be moved to .deployment
but the problem is .deployment
is in our .dockerignore
. Not sure where to put this file.
…-pyls-integration
…uageServers (test)
No, I have not, but I will have a look. |
I think the issue had to do with |
Nice. That fixed it for me - thanks! Now I can check out the rest of it :) |
Overall, this looks good. A couple issues (I already mentioned them in slack but putting them here, too):
After ensuring it is disabled for editor.deepforge.org and the GitHub action is reverted, feel free to go ahead and merge it! |
In verbose mode, using the
This might be at the root of performance issue as new client gets instantiated as soon as this error is encountered. The minified files have no source maps, It might be good to investigate this further. |
To run this PR locally. Checkout the branch:
$ docker build -t langServers:latest -f docker/Dockerfile.langservers .
components.json
to add the following key:npm start
: