omnisharp-emacs icon indicating copy to clipboard operation
omnisharp-emacs copied to clipboard

Add feature: rename current file

Open mikavilpas opened this issue 11 years ago • 3 comments

Example interface to user:

"Rename current file to: (defaults to old name)"
"Renamed (old-file-name) to (new-file-name). Delete old file? (y or n)"

Rough plan:

Should save the current file, then

  • remove old-file-name from project
  • save current file with new-file-name
  • add new-file-name to project
  • ask if user wants to delete old-file-name (that is now not included in the project), and delete it if they want to.

mikavilpas avatar Sep 17 '13 12:09 mikavilpas

(I know this is an old issue, but just for reference...)

You can do it with:

(defun rr/omnisharp-rename-file ()
  (interactive)
  (let ((new-file-name (read-file-name "new name: ")))
    (omnisharp-remove-from-project-current-file)
    (dired-rename-file (buffer-file-name)
                       new-file-name
                       nil)
    (omnisharp-add-to-solution-current-file)))

rranelli avatar Apr 21 '16 20:04 rranelli

I didn't realize issues this old are still active. :smile: That is a good solution - let's keep it here and see whether it's still applicable to the roslyn branch. :+1:

mikavilpas avatar Apr 22 '16 05:04 mikavilpas

Hey correct me if I'm wrong but when I run this I get: let: Symbol’s function definition is void: omnisharp-remove-from-project-current-file I did a grep search for that function in elpa/omnisharp-20170909.319, and it come up with nothing. So I don't think this solution can work anymore.

phoenixanimations avatar Sep 14 '17 16:09 phoenixanimations