codingbelief / atom-gtags

Gtags for Atom
MIT License
9 stars 1 forks source link

Fix and improvement #8

Closed darfux closed 7 years ago

darfux commented 7 years ago

Hi, thanks for your great work on this package :smile: In my daily use of this package, I have encountered some problems and finally solved them. Here's the summary:

1.Fix the deprecated warning in Promise.done() d1fef2d3cc7832f3c8f4274bf6234182a35e700c

Promise.done() has been deprecated in recent Atom version:

# Preserve this deprecation until 2.0. Sorry. Should have removed Q sooner.
Promise.prototype.done = (callback) ->
  deprecate("Atom now uses ES6 Promises instead of Q. Call promise.then instead of promise.done")
  @then(callback)

2.Fix GtagsSymbolsView's double cancel issue 0883e5dbbeda0025fc0bcfd5b4ef76edd2264744

SelectListView will get a blur event as the GtagsFiles.open() activates the pane, which causes the list losing focus. And the SelectListView's blur callback calls the cancel().

@filterEditorView.on 'blur', (e) =>
  @cancel() unless @cancelling

So we do not need to call cancel() here any more.

3.Add a useRelativePath option in Package Settings b24eb299a341dff3f94f32571ab3be635d568f2f

Sometimes the file path of searching result is too long for the list to show. For example: screenshot from 2017-05-06 19-16-40 So I add an option to only show the relative path in the result list: screenshot from 2017-05-06 19-21-26

4.Change GtagsEnv to extend process.env rather than clone e7919f410cf539b83377b45357d6ac3a67ec8f99

The value assignment of cloned object will also change process.env, because they are sharing the same process level variable (current process's enviroment). See test below: image

So we just need to extend a object that has same properties with process.env here: image

5.Fix a race condition in GtagsFile.preview() 79a0ec1e6cd85a184fc92a1293b200faceaa7184

If the GtagsFile.preview is called twice in such a short time that the first subscription isn't invoked. Then the latter call will override GtagsFiles.subscription, which causes the former never be disposed().

codingbelief commented 7 years ago

Thanks for the PR ~~