How can I refactor file names in Visual Studio Code? - visual-studio-code

Is it possible to refactor the name of the files in a project and automatically update all the imports, without caring about breaking something each time a file name is changed?
In the same manner as in the JetBrains' products. You change the file name and everything is automatically updated.

Actually you can. Natively on Visual Studio Code (>= v1.28) with import path renaming:
Or with some extension like Move TS.

Sorry, but the answer is just simple: No, you can't.
At least not currently. It's up to the authors of the language modes to implement such things. There is support for the occasional variable refactoring here and thereā€¦ And there are some additional extensions in the JavaScript space that support method extraction and stuff, but none of them handles filename refactoring.

This should be easier with VSCode 1.53 (Jan. 2021):
Improved Refactor Participants UI
Extension can participant when use create, move, rename, or delete files.
This is useful to automatically run refactorings, e.g. when renaming a Java file you also need to rename its public class.
There is now unified UI for these participants which allows you to accept, skip, and preview additional changes an extension is making.

Related

VSCode Dart/Flutter not rename import when rename the file

I'm coding Dart/Flutter in VSCode.
How to fix the problem where VSCode did not rename all import when I rename .dart file?
Is this the extensions bug or it's an unimplemented feature?
This is an unimplemented feature.
Originally the APIs in VS Code and the Dart analysis server were not compatible (VS Code would only tell us after the file was renamed, but the Dart server needed to know before the rename to create the correct edits).
This has recently changed - VS Code now has APIs that allow us to hook into the rename before it happens, but it hasn't been implemented in the Dart extension yet.
For notification when it is implemented, you can subscribe to this Dart-Code issue (otherwise, it'll be included in the release notes when it's done).

Custom Extension Adjustment to 6.2

I currently got the task to upgrade a custom made CRM extension named "kbs". It was developed on TYPO3 4.7 and using old namespaces in its classes like "Tx_Kbs_Service_TestService" etc.
I want to upgrade this whole extension to be able to work properly with our current backend version of 6.2. More specifically i want to be able to use the extension builder to make changes to this extension which i am currently not able to do on the 6.2 TYPO3 backend. It is not even an option to select the "kbs" extension in the extension builder.
Of course i reasearched the web but I find it very difficult to find information what you have to do in order to addapt a custom extension.
So far I assume that i will have to change all the namespaces in all my classes manually and maybe watch out for decrecated classes. But I do not really know if that is the way to go.
Does anyone have and guidelines, links or tipps for me? I would really appreciate it!
Thanks in advance,
Simon
To the first question:
In extension_builder only extensions are changeable, they had their original configuration made by extension_builder.
Extension builder itself is only an option to use, and there were also other options to kickstart an extension.
Update:
This is true, that extension builder is not an "editor" for extensions but a tool to help kickstarting an extension.
If I would get the task and extension_builder would be available I would not use it to make changes on the code. It is not 100% sure, that manually changes were not made on the code after its last automatically generated version. And if dummy actions were changed and properly excluded from the config they could be also deleted.
I think your best choice to change the things manually.
There are two source to read first:
TYPO3 6.2 Release Notes.
What's new presentation (TYPO3 6.2)
They contains breaking changes and some example.
If you do not change the PHP version, than changing the Namespaces and some deprecated functions. (The sources above could help to get an idea on those)
One tricky part could be to migrate old image logic into the "new" FAL (File Abstraction Layer). If you don't need to deal with images, then it must be an easier thing to go with.
There is also an extension to help with some migration stuff: smoothmigration.
You can find some hints in this presentation also:
jweiland: Smooth Migration TYPO3 4.5 > 6.2 LTS

VS Code resx file extension

Seems like there is no way to automatically create and manage resx files in VS Code now. Does someone know extension for it?
P.S. Yeah, I know that I can edit resx file as bare xml, but it`s not a right way.
The problem with resx is that it uses a Visual Studio "Custom Tool" to generate the code for the resources, and so requires Visual Studio to function fully.
I've been working on a replacement to resx that should also work from VS Code. It uses json rather than xml to define the resources, but otherwise behaves much like a resx file. The json resources file uses a ".resj" extension, and has a very simple structure. It currently only supports string resources that can be defined either inline in the json, or in an external file reference.
The project is open source on GitHub here:
https://github.com/MarkPflug/Elemental.JsonResource/
This is available as a nuget package "Elemental.JsonResource", currently only pre-release. Simply add this package to your project to enable using resj files. It doesn't add a runtime dependency to your project, everything is done at build-time. My hope is to provide feature-parity with what a resx file can do, but it could be useful even in its current state.

Human editable snippet store in eclipse

I am looking for a easier way to manage my eclipse code snippets. I know and have used Eclipse's template and snippets features. But as far as I have found, they can only be exported and imported as XML files.
Since I use many versions of eclipse and I keep migrating between machines managing the snippets is a hassle. I am looking for a UltiSnips like method to manage these snippets/templates. Is there one?
I also looked at snip2code, but it didn't appeal to me because I sometime work offline. Also, I want to have much greater control over the snippets using version control.
Oh well! I couldn't find anything that matched the set of requirements I had. So, I've ended up creating my own.

How to display bazaar version number in a latex document?

I am using bazaar as a version control system for my research. I have many latex documents. I want to display the version number in all the .dvi files under bazaar.
The easiest way to accomplish this will be to use make or a similar build manager to generate your .dvi files.
Your Makefile should include a new target called version-number:
version-number:
bzr revno > VERSION.tex
and your .dvi targets should depend on version-number:
my-project.dvi: my-project.tex [OTHER STUFF] version-number
In your .tex files, at an appropriate place (in the header/footer, title block, PDF metainfo, etc) you would include the version number stored in VERSION.tex:
\input{VERSION}
When you set this up you should bzr ignore VERSION.tex so that it won't store its own version number, of course.
This is all based on a similar technique used for git in the Common Lisp Quick Reference project.
Maybe the bazaar keywords plugin can help you.
I have used the latex VC package successfully with Bazaar. It works using an external script that is called during compilation by \write18. This may seem overkill but it provides a lot of functionality and works well.