edubkendo / atom-racer

Intelligent code completion for Rust in the Atom Editor. Requires Racer.
MIT License
115 stars 24 forks source link

atom.services is no longer available #15

Closed koleesch closed 9 years ago

koleesch commented 9 years ago

atom.services is no longer available. To register service providers and consumers, use the providedServices and consumedServices fields in your package's package.json.

Atom.Object.defineProperty.get (/Applications/Atom.app/Contents/Resources/app/src/atom.js:64:11)
Object.activate (/Users/stefan/.atom/packages/racer/lib/racer.coffee:20:25)
koleesch commented 9 years ago

I got the message in atom after installing the packages racer and autocomplete-plus

koleesch commented 9 years ago

my atom version is 0.177.0

alkama commented 9 years ago

Oh, right, the new Atom version does use a new descriptive way to declare services. As warned in:

I'll correct this as soon as I understand what needs to be done (which, with the rapid change of atom's API, might take some time...) :)

Anyway, it's "just" a deprecation warning, it shouldn't break for now.

joefitzgerald commented 9 years ago

@alkama My understanding is we have a very short window to make this change prior to atom.services being removed entirely. Think 1 or 2 atom versions.

The fix is quite simple, and I will update the docs shortly (once I have a proven working example of a provider using this technique). In essence: you include some config in package.json, and add a function that is called in your mainModule.

alkama commented 9 years ago

@joefitzgerald yes, that's what I understood too. They sure seem to be in a hurry :) It ain't that dramatic thought.

I understood too that what we need is to add some:

{
  "providedServices": {
    "[NAME]": {
      "description": "lorem ipsum",
      "versions": {
        "[NUMBER]": "[METHOD]"
      }
    }
  }
}

What I still dont get is:

My best guess is I would do something like:

{
  "providedServices": {
    "autocomplete.provider": {
      "description": "Intelligent Rust code completion",
      "versions": {
        "1.0.0": "provideAutocompletion"
      }
    }
  }
}

and

module.exports =
  provider: null

  activate: ->
    @provider = new MyProvider()
    return

  provideAutocompletion: ->
    return @provider # or return {provider: @provider}, who knows :)

  deactivate: ->
    @provider?.dispose()
    @provider = null
    return

But I'm probably wrong :) Anyway, thank for your nice work on autocomplete-plus !

joefitzgerald commented 9 years ago
{
  "providedServices": {
    "autocomplete.provider": {
      "description": "Intelligent Rust code completion",
      "versions": {
        "1.0.0": "provideAutocompletion"
      }
    }
  }
}

is correct.

joefitzgerald commented 9 years ago

return {provider: @provider} is correct.

alkama commented 9 years ago

@joefitzgerald thanks, it indeed seems to work.

alkama commented 9 years ago

fixed in v0.9.1