atom-ternjs icon indicating copy to clipboard operation
atom-ternjs copied to clipboard

Do not show Rename command on grammrs other from javascript

Open sadovnychyi opened this issue 9 years ago • 5 comments

When I'm editing python file: image

sadovnychyi avatar Jan 13 '16 04:01 sadovnychyi

I am not sure, if this is possible.

tststs avatar Jan 17 '16 20:01 tststs

From Tern site: "Tern is a stand-alone code-analysis engine for JavaScript.". It doesn't pretend to work on other languages!

Atom has a Refactor package that aims to be language-agnostic. Eg. it requires a js-refactor package to work on JS code. Perhaps it has something for Python.

PhiLhoSoft avatar Apr 21 '16 11:04 PhiLhoSoft

I'm not looking for a way to use rename on different languages, I want this JS related command to be hidden on different grammars. Atom does support grammar-specific commands, you just have to add specific selector for each command you create.

sadovnychyi avatar Apr 21 '16 11:04 sadovnychyi

Ah, sorry for misunderstanding your request, which is legitimate: reduce noise. Well, I notice Tern's context menu is not there on non-JS files, for example. On the other hand, if you take a command from an official Atom package, like MarkdownPreview, it appears in the Command Palette even in non-Markdown files. So, as @tststs said, maybe it is not possible.

PhiLhoSoft avatar Apr 21 '16 12:04 PhiLhoSoft

I do have python related "rename" command in autocomplete-python, and it does not shows this command in non-python files. As for me, this is important. Since I will never use it outside of python files.

https://github.com/sadovnychyi/autocomplete-python/blob/master/lib/provider.coffee#L113-L115

sadovnychyi avatar Apr 21 '16 12:04 sadovnychyi