Editing multiple files - algorithm

I have the following problem:
I want to add the same text to multiple files. Specifically, I want to add an extension to a .dart file I'm not sure if there is already a pre-defined way for this in JetBrains' products (maybe not, but Android Studio for example).
class <classname> <add text here> //like in my case extends Class
The process would be
I select a bunch of files
I define my text I want to add
To all the files where it finds class it skips the next word and inserts the input.
If you wanted to achieve this without manually copy-pasting, how would you do it?

Thanks #LazyOne
With your suggestion, using the following regex solved the problem
(class)(\s.*)(\{)
replace with
$1$2extends <class>$3

Related

How to replace/remove tag in multiple csproj files

Is it possible to remove tag from multiple csproj files (e.g. NuGetPackageImportStamp) by using search and replace functionality?
Actually Notepad++ has 'Find in files' functionality to replace in files in the selected location. It is possible to insert filter, use regex...
Sorry for bothering. I didn’t even think to look there.

Using Visual Studio's 'Find', is it possible to exclude specific files from the search?

Let's say i refactored some code in my huge solution, now i want to be sure that there are no occurencies of my old code (including specific words in strings and so one).
Problem is, that i have a huge, automatically built file (imagine something like a 'compiled' app.js), which is allowed to contain string values of my old code.
With the 'Find' functionallity of Visual Studio, is it possible to skip this specific file?
One possible way I could think off is Look at these file types field present in Find and Replace (Shortcut: Ctrl + Shift + F).
You could specify the file types with extensions or/and names. You could use multiple names separated by a semicolon.
Ex: Say you want to search in all XAML files & all CS files starting with A. You would enter this in the Look at these file types field: *.xaml;A*.cs
If you simply want to ensure that your only matches are in that one file, you can check "Display file names only" option in "Find in Files", and verify that there is only that file name in the result pane.

loading macro files in a directory, transparently

I am looking for a way to separate the repetitive html codes from web pages, and for this I am planning to use the macro functionality. The problem here is for every macro I need to put this macro in a file, or put some of them in a file and include this in the template file.
What I need is to include once just the directory name something like
<#import "/tags/widgetDirectory" as widgets />
here the /tags/widgetDirectory is a directory , and every files here can be seen as a macro defined.
when I need to insert a code part from a file from this directory lets say slide.ftl I will just use
<#widgets.slider />
the system will check for slider.ftl in the /tags/widgetDirectory directory . here the slider.ftl can have <#macro> as first and as last line , or these can transparently added and system can load it as a macro
this will easy my designer work.
Maybe there is better way for doing this kind of widgets/components based web design ?
best regards,
This feature (importing directories) is something that's planned for FM actually... but it won't happen anytime soon. But I guess it can be solved fairly well with a hack right now. Instead of #import, use your own TemplateMethodModelEx, that you could use like <#assign widgets = importDirectory('/tags/widgetDirectory') >. This will return a TemplateHashModel that's also implemented by you and is bound to the directory path. When an item of that hash is get, it uses Environment.getCurrentEnvironment().include. The included file is expected to create a macro with name __main or something. So then you get that variable with Environment.getCurrentNamespace().get("__main") and return it as the result of the hash lookup. Of course this hash should also maintain a cache, so that if the same item is get twice, it wont include the template for the second time, just return the macro extracted earlier. This can be developer further, so that if the include file didn't define __main, then it's supposed that it prints directly to the output, and so it will be included again, when the "tag" is called again.

How to maintain Interface and Implementation in separate files simultaneously in Xcode

I have several lines of code of a written class with Interface written in testclass.h and implementation written in testclass.m in Xcode. I wish when I update an entry in testclass.m, its counterpart in testclass.h can be updated automatically.
For example, I have an interface for following function in both testclass.h and testclass.m:
-(void)testfunction
And I modified its name to a different one due to some reason in testclass.m to:
-(void)another_test_function
If I want this code to run I need to manually change the entry in the header. Although I'm very new to programming but I can imagine it could be really frustrating if you are trying to modify something in a big program with a lot of different files invoking some modified entry name. I wish Xcode can auto-detect this change and modify the entry in the header file to -(void)another_test_function automatically.
Is there any way I can do that? All I know by searching the internet is that you can use a shortcut to "edit all in scope" but this only affect all the occurrence in the same file, not header file.
Right-click the method name you would like to change (in either the header or the implementation file) and then select Refactor > Rename. You can then change the name of the method, and Xcode will show you what it will change.
If that looks good, you can accept the changes and you're done.

Reference custom table in WiX fragment file

I want to create a fragment file that will only contain a CustomTable in the file. This is easy enough, but I do not know how to link/include it back into the main product.wxs file.
The fragment file is in the same project as the product file, and I have also tried adding an include tag for the file without success, and even putting the custom table into a WiX include file.
Is there a way to do this? Or is it going to have to live in the product file?
The WiX toolset compiles and links in a similar manner to the C/C++ compiler. The linker starts at the "main" entry point (Product element, in your case) then follows the references from there, which in turn follows references from there until all are resolved.
Part of your question is missing but based on the title I'm going to guess that you want a CustomTable element. Typically that CustomTable is processed by a CustomAction. There are a couple good ways to reference a CustomAction.
I would not use an include file.
You could try using EnsureTable if you'd like to make sure the table is created whether or not there is data in it. If you'd like to separate the custom table's schema definition from the data I believe you can just define them in separate fragments and reference the schema definition from the data definition fragment by opening with <CustomTable Id="your table name"> and defining the rows of data within it.
In general Wix won't pull fragments into the main authoring unless they contain elements that are referred to somewhere and since there is currently no such thing as CustomTableRef you may opt to use other elements such as an empty PayloadGroup or ComponentGroup that you can refer to (using a PayloadGroupRef or ComponentGroupRef respectively) from your main Bundle, Product or Module element as the case may be.

Resources