aws-samples / amazon-sagemaker-codeserver

Hosting code-server on Amazon SageMaker
MIT No Attribution
48 stars 17 forks source link

Missing IntelliSense or code auto completion #30

Open rinkist opened 10 months ago

rinkist commented 10 months ago

Hi,

We followed the tutorial and set up a working code-server instance running on Sagemaker Studio. One very crucial part is to have IntelliSense or code auto completion when working with packages like pandas, etc.

However, this code completion seems not to work with loaded modules/packages like pandas or numpy but with internal defined functions/method/classes only.

Since code-server can not use pylance as a LSP, I made the change to "Jedi" as the default language server. In my local set up (running code-server on a local machine) the auto-completion works out.

However, in my Sagemaker Studio hosted environment it does not. Code completion is quite essential for us (otherwise we can also stick to a text editor).

Therefore, I wanted to ask if you faced similar issues? The problem could be the environment code-server is running in (e.g., no access to the installed packages to make suggestions)

P.S. I ensured that the pandas package is installed in the used python interpreter as well as in the conda env the shell is running in

giuseppeporcelli commented 10 months ago

Hi, can you please share your current configuration (code-server version, extension versions, networking, etc.)?

As you can see in this screenshot, IntelliSense was working well: https://github.com/aws-samples/amazon-sagemaker-codeserver/blob/main/images/code-server-intellisense-sm.png

As a consequence, we need to investigate when and were this regression was introduced.

rinkist commented 10 months ago

Hi, Thank you for your fast answer!

I have done further investigations in this direction and have to rephrase my original statement.

IntelliSense works for packages that are (pre-) installed in the conda environment studio but not in any other.

When I install code-server (4.15.0) on Sagemaker Studio, I have the following conda environments available:

The code_server_py39 (3.9.17) is automatically selected when starting code-server.

However, if I install new packages (i.e., pandas) in this environment I would not get any IntelliSense support for it.

It only works if I install new packages in studio (3.9.12) and select this environment at least once in code-server so (my hypothesis) code-server can make a connection to the packages installed in studio (3.9.12). After that I can switch to any other env in code-server. However, I would only get IntelliSense support for packages installed in the mentioned studio env.

I can for now live with it. However, in best case code-server would read the packages of the current selected env so that one does not have to "pollute" the studio env with packages.

Setup:

Versions:

settings.json:

{
   "workbench.colorTheme":"Monokai",
   "[python]":{
      "editor.defaultFormatter":"ms-python.black-formatter",
      "editor.formatOnSave":true,
      "editor.codeActionsOnSave":{
         "source.organizeImports":true
      }
   },
   "isort.args":[
      "--profile",
      "black"
   ],
   "python.languageServer": "Jedi"
}