How can I edit core packages?


#1

Hello, everybody!

I need to add autocomplete for language extension which is currently not support by Atom autocomplete-plus.

This language is very similar to another, like SCSS to CSS. Is it true that I need to edit autocomplete-css package?

But I cannot view and edit code of this package from the Atom editor, because it’s core package. So, what I need to do to solve this problem? Sorry if this question is stupid.


#2

Atom provides the apm develop command to easily start working with any Atom package. See the apm develop --help for details.


#3

@leedohm Cool! Thanks a lot!


#4

While @leedohm answer perfectly fit the title of the thread How can I edit core package, you do not need to edit autocomplete-plus in order to provide new autocomplete suggestion. Actually it might be one of the less maintainable way to do so.

Fortunately autocomplete-plus support extensibility using providers, which is probably the way you want to go.

Is it true that I need to edit autocomplete-css package?

autocomplete-css is one of such provider package, so is autocomplete-html and a few others. Mimicking what already exist could be a great way to learn to write a new provider.

But I cannot view and edit code of this package from the Atom editor

Source of core autocomplete-* package are also available on github under the atom organisation.

https://github.com/atom?utf8=✓&query=autocomplete


#5

@leedohm, @jeancroy, Oh. that’s not what I want.
I need to edit code of installed core package. Not clone package from GitHub repository. I want to see changes in the editor immediately after editing code. As if I create a theme and constantly press Ctrl+Alt+R.


#6

Because of the way Atom is packaged, there isn’t a good way to do what you’re asking anymore. The best way to do what you’re asking is to:

  1. Use the apm develop command
  2. Launch Atom in Dev Mode with the atom --dev command
  3. Change the code in the package or packages you want changed
  4. Depending on the change, reload Atom with Ctrl+Alt+Cmd+L on OS X or Ctrl+Alt+R on other platforms

If you’re trying to change the Atom core code (the code contained at https://github.com/atom/atom) itself. You can find more information on how to do that best here:


#7

@azat_io did you manage to do that? I am trying to have autocomplete-html snippets work with js files but was not able to do that. added the .source.js to provider.coffee but it did not do the trick.

module.exports =
selector: ‘.text.html .source.js’


#8

You need a comma there, like you can see here.


#9

thx. it still doesnt work for me. I think b/c it is a core package and I may need to build atom in order for it to work.


#10

That’s not it. If you have a custom package with the same name as a core package, the core package will be overridden (and you could disable the core package to be sure).


#11

Packages are disabled by name. I expect that if you disabled a package named “foo”, no package named “foo” would get loaded whether core or community.


#12

thanks @DamnedScholar. it indeed work. it turns out you cannot disable the core packages and enable the dev one as they are enabled and disabled together case they carry the same name. but the dev package indeed overrides the core one in dev mode.

my aim was to have html snippets in js scope but it rurns out that autocomplete-html is not the right package but rather the language-html. I could not understand how to have language-html run in js scope. is it at all possible?


#13

You would just change the snippets file. You don’t need to mess with the grammar.


#14

great it works. now that jsx is so popular with react maybe it is a good idea to add support for html in js scope at least as an option. what do you think?


#15

There’s a package for that.


#16

This great reply from DamnedScholar might help:


Different comment styles in different colors on JS
#17

@leedohm is there a way to use a fork of a core package in regular mode instead of dev mode?
I made a PR to find-and-replace to add really sophisticated preserve case functionality, but judging from other PRs in that package I doubt it will get merged anytime soon, so I’m looking for a way to always use my fork of that package without dev mode.


#18

Instead of apm develop, use apm link followed by apm install. You should also consider publishing your fork as a standalone package.


#19

:thinking: mmmmmm

Up to now I have only did the link bit. Up to now I have not seen an issue. But I also did an update of all dependencies from inside Atom.

Please: What does install part do additionally to using link?


#20

All link does is create a symbolic link inside .atom/packages/. install downloads dependencies and runs any installation scripts mentioned in package.json.