Giter Club home page Giter Club logo

vscode-xonsh's Introduction

If you like the template click ⭐ on the repo.

Overview

Adds xonsh language support for VSCode Editor.

Features

  • Syntax Highlight

    • the tmLanguage file from MagicPython extension is used.

    • code snippets inside markdown files also work.

  • Other IDE like features using Language server protocol.

    • pylsp is used for jedi completion.

Installation

Visual Studio Code

Hit F1 and enter the ext install jnoortheen.xonsh command or search for xonsh .

Python-language-server

  • Make sure that pylsp is installed and available on the $PATH
  • I recommend using pipx
pipx install 'python-lsp-server[all]'
  • Previous versions of this extension used the older pyls by Palantir. Further development is taking place in the community fork pylsp. Due to the way configuration variables are handled, this extension is NOT backwards compatible with pyls. If you must use pyls, please downgrade to version 0.1.13.

Contributing

I have created this extension since there were none to support Xonsh. PRs are welcome to add new features/fixes.

Please make sure that you

  • Document the purpose of functions and classes.
  • When adding a new feature, please mention it in the README.md Features section. Use screenshots when applicable.
  • Conventional Commit style should be used for commit messages as it is used to generate changelog.

Development

  • TypeScript is used to develop the extension
  yarn install
  yarn build # this will build the extension

Release

yarn release
  • Github CI is configured to publish the extensions to VSCode and OpenVSCode registries

Special thanks to

  • The extension sublime-coconut does support coconut language. Which is also a superset of Python.

Links

vscode-xonsh's People

Contributors

anki-code avatar dependabot[bot] avatar jnoortheen avatar maresb avatar wight554 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-xonsh's Issues

${...} support

Hi! Thank you for the extension!

Add ${...} support:

Screenshot_20201007_125614

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Add xontrib topic to the repository

Hi!

I think it will be great to add the xontrib tag to repository topics. I understand that xontrib topic is mostly using for the installable extensions for xonsh. But xontrib means "contribution" and it's not a problem to add this repository to the list of xontribs on Github to get more stars and attention.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Better windows support

Hello there
Noticed windows doesn't runs well with this ext until you do
"pyls.executable": "pyls.exe"
Unfortunately this isn't great for cross-os settings sync, so would be better to workaround it at extension level

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Add $variable support

Hi! Thank you for the extension!

Add $variable support that includes $ sign:

Screenshot_20201007_125408

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Potential conflicts with pylsp configuration variables

Currently, all of this extension's configuration variables are of the form pylsp.plugins.[something]. This seems to violate the (implicit or explicit?) convention that configuration variables should always begin with the extension's name. In other words, configuration variables in our case should instead be of the form xonsh.pylsp.plugins.[something].

While using the VS Code Settings Manager, I have been confused when seeing these settings because I didn't realize they were under the "Xonsh Language Server" heading. For instance, if one searches for "jedi" from the search bar, then the search results do not show the headings. Thus, based on the "convention" the search results appear as if "Pylsp" were an extension with its own VS Code settings.

A potential future problem that may arise is: what happens if another extension also tries to make use of these pylsp.plugins.[something] configuration variables? Suppose someone makes a scripting language called Yonsh and a corresponding vscode-yonsh extension which works similarly. If its configuration variables are also pylsp.plugins.[something], then it would be impossible to configure vscode-xonsh and vscode-yonsh independently.

I'm not sure yet what is the proper way to fix this, but I have started investigating...

If I understand correctly, the plugin's client uses package.json's contributes.configuration.properties in order to define configuration variables, all of which start with pyls/pylsp. The client is then configured on activation to synchronize these settings via this pyls/pylsp prefix.

On the server side, this settings prefix seems hardcoded for synchronization here, and the settings themselves seem to be defined through some system involving entrypoints. Then it seems that pluggy is somehow used to decorate functions so that they receive the configuration, but I don't quite understand this mechanism.

A few other interesting observations:

  • Using this configurationSection is deprecated. Here it is briefly explained that the old push model for settings has been replaced by a new pull model. Here is a bit more discussion on the topic.
  • In my very limited understanding of LSP, and the pull model, it seems that the client is responsible for sending the configuration settings to the server. Thus it seems to me like a client should theoretically be capable of taking the VS Code settings in whatever namespace (e.g. xonsh.pylsp.plugins.[something]) and translating them into the hard-coded settings which the server expects (i.e. pylsp.plugins.[something]).
  • I was searching for an example client using the pull model. I came across this as potentially being the new way to initialize a client. But my JS is very bad, so I can't really be of much help there.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Incorrectly adds spaces

Autoformatting adds unwanted spaces in shell commands (at least with default settings), for example:

ls -l *.xsh becomes ls - l * .xsh when saving a .xsh script.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Add suggestion support in python operator

Hi! Thank you for the extension!

I think it will be great to create distinct issues for everything we want instead of listing in the README.

Add suggestion support in python operator:

Screenshot_20201007_124530

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Appears not to work when ssh'd into remote machine

This extension doesn't work for me for remote development via ssh.
Specifically, I get the error "Unable to find Python language server".

I've followed the installation instructions, both for my local environment (MacOS) and a remote environment into which I ssh (Ubuntu 22.04).
In each case pylsp is on $PATH and if I open a terminal in VS Code I can type which pylsp and see that it's installed.
For local development the extension works well.
But I get the above error for remote (ssh) development.

Any idea what might be wrong?

Thanks for making this tool!

Use Xonsh in the integrated terminal

It would be great if this extension could provide a "shell configuration" which would allow you to use Xonsh in the integrated terminal. (Especially since it seemed a lot easier to do the last time I used VSCode).

I believe this would make it a lot easier to use Xonsh, and it has already proven to work for other shells such as nu. I believe the following code in the nu-shell VSCode extension, adds the terminal configuration: https://github.com/nushell/vscode-nushell-lang/blob/main/src/extension.ts#L5-L92

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.