Glitch VSCode extension - Python formatter and linter

Formatter beyond prettier/Glitch for Python

A very convenient setup is to use flake8 as linter and black as formatter. There is a glitch vscode settings file but I could not find the right way to set it up.

Please let me know if anybody has tried to solve this. Ideally, I would like to use a poetry environment with me dev dependencies. Until then I will just make more often use of that quirky import button to pull a git update.

Again, VSCode Glitch extension is great!

If you want to get python formatting an linting, you can always look for extensions as Glitch does not support custom linting with the VSCode extension. In fact, by default, I believe that python is linted in Visual Studio code.

1 Like

Hi RiversideRocks,

Yes, it is definitely the right direction to try to get the other Python extensions working with Glitch. The problem with python related extensions is that they rely on your development environment.

So with no further setup hacking you will not get the python extensions running. But Glitch does work with the other extensions if you manage to connect to a Poetry environment and edit the Glitch settings file by opening workspace settings. The Poetry environment will turn on Intellisense. The python extension works that way.

Poetry environment I selected in VSCode:

Screen Shot 2020-08-16 at 2.48.46 PM

For more information on Poetry you can check this blog article. Please like it and drop a comment, if you feel like it. It helps with the algorithm.

How to get into your workspace settings:
Screen Shot 2020-08-16 at 2.44.51 PM

And now you can tinker with the settings. You may want to choose the option format with (see above in the screeshot). This will make the Glitch formatter (Prettier extension needs to be installed, I believe) format the JSON.

The settings that turn on the flake8 linter and the black formatter based on 88 chars:

{
  "folders": [
    { "name": "🎏 wit-ai-pywebhook", "uri": "glitchfs://wit-ai-pywebhook" }
  ],
  "settings": {
    "editor.defaultFormatter": "glitch.glitch",
    "editor.formatOnSave": true,
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    "files.eol": "\n",
    "files.exclude": {
      "**/.vscode-glitch/cache/**": true
    },
    "files.trimTrailingWhitespace": false,
    "git.autoRepositoryDetection": false,
    "python.linting.pylintEnabled": false,
    "python.linting.flake8Enabled": true,
    "python.linting.enabled": true,
    "python.formatting.provider": "black",
    "python.linting.flake8Args": ["--max-line-length=88"]
  }
}

Sometimes it lags and this is not part of the Glitch extension features. So be patient with the Glitch extension and the code will always be saved. Also, I don’t like that “autoSave” has to be turned off anytime you start a project. It is not my preference but I understand some people may like it more. I suspect it is more stable to turn off, though.

Ok, I see what you are saying. The only issue is that glitch does not provide the linting or formatting, they use third party services.

Yep. Let’s see how Glitch evolves. The extension is amazing as you get to really develop live. The remote ssh extension on VSCode is not as good.

1 Like