[Solved] Default scope names


#1

I wonder why all my python files are recognized by default with the Python (Django) scope name instead of simply Python.

I know I can setup atom to correct this, but is this the normal default behaviour at all?

On another hand, I work on Python projects and on Django projects too. I notice that the flake8 linter does not start (any longer?) on Python Django files. So I have to setup atom to recognize .py as Python files when I open a Python project, but setup atom differently to recognize .py as Python (Django) files when I open a Django project (in order to run a different linter, for instance)?


#2

If you use project-manager, I think you can set up your config option “customFileTypes” for each project. I haven’t tried it yet.


#3

It’s normal. Packages that serve the needs of frameworks and templating languages often need to override the base language package for files with the same file extension. Python (Django) shouldn’t prevent you from doing non-Django things.

I’m not sure why flake8 isn’t working, but it probably has to do with scopes. atom-django applies the source.python.django scope, which I would expect to be matched by a package looking for source.python.


#4

Thanks for your answers!

I couldn’t find any relevant option in package manager.

Also I noticed that another workstation, where the linter did work, showed “MagicPython” as scope. After short investigation I noticed that the non-working workstation also had MagicPython installed but core package language-python not disabled, so I disabled it and now it works. So probably this was the problem, although this does not really explain why the Python (Django) files were ignored by flake8. Also I don’t know why it has worked for a while and then suddenly not anymore (maybe a recent update changed things?).

Anyway things are fine now. Linters are so important tools, it’s a relief :slight_smile:


#5

The option is kind of buried in a table:

settings: Object: Enables you to set project specific settings. Everything that goes in the config.cson file can go here. It also supports scoped settings.