LaTeXTools icon indicating copy to clipboard operation
LaTeXTools copied to clipboard

Feature Request: "Refactor/Rename Label"

Open diego898 opened this issue 8 years ago • 3 comments

I think it would be useful for latextools to offer to automatically change all occurrences of a label's name across project/directory latex files as you change them where they are defined.

I know one can accomplish this with find/replace across files, but currently I have to specify which files, which is sometimes annoying. This system could work in all files that match the top-level file for example.

diego898 avatar May 08 '17 19:05 diego898

Would you envision such a command working from the \label alone or from any of the corresponding \refs as well?

ig0774 avatar May 09 '17 11:05 ig0774

I have also played with the idea of an IDE-like rename command (similar to the IDE-like jump-to-anywhere). This is reasonable and should be possible (even if not 100% sound and complete), but we need to adapt the analysis first to handle nested commands (\textbf{see in Table~\ref{tab:mytable}}).

This would include:

  • file names (\include/\includegraphics/...)
  • labels
  • glossaries/acronyms
  • self-defined commands

I already made a small demo how it could work (I needed that for myself):

  1. start the rename command: a border is created around the parts, which will be renamed and the rename type will be auto-detected based on the surrounding command
  2. just change the content inside the border to what you want
  3. press enter to execute the renaming (maybe escape with cancel-dialog to cancel it)

rename_file

r-stein avatar May 09 '17 12:05 r-stein

@r-stein Your demo is a great idea!

diego898 avatar May 09 '17 14:05 diego898