Can notepad++ support sqlcmd syntax somehow? - syntax-highlighting

I like using notepad++ for my syntax editing because it can handle all the languages I work in.
However, when I load a TSQL script that uses SQLCMD stuff, it messes up the highlighting.
For example, if you have a sql file with this in it :setvar DefaultDataPath "D:\Data\" then everything after that will be light grey.
Is there a way to tell notepad++ to not do that?

It seems the issue here is coming from the \" at the end of your line. Notepad++ appears to be translating that as an escaped quote (") so it believes to still be in the same string.
I have not seen anything in Notepad++ that would automatically fix this for you (but to be honest I did not look too much into it). Some alternative options:
"D:\Data"
"D:\Data\""
"D:\Data\\"
I notice Notepad++ having these types of problems quite often but they are purely cosmetic issues.

Related

Why does my search path content have so many backslash?

I have a project and I've found that the content in search path has many backslash at the beginning and the end of the correct search path.
It it like
\\\\\\\\\\\\\\"$(SRCROOT)/MY-SEARCH-PATH"\\\\\\\\\\\\\\\
So is it a bug or something I did wrong?
It looks like you're using some kind of tool (like Cocoa Pods or similar) on your project that modifies the project file. This tool might have a buggy way of interpreting build settings and saving them again.
No idea, however it's wrong and should be changed back to:
$(SRCROOT)/MY-SEARCH-PATH
(i.e. no backslashes and no double-quotes)

Running Macro in Notepad++ from Commandline

Is it possible to run a Macro which i record in Notepad++ from the Commandline? Say i record a Macro to search and replace, which i can run in Np++ for the whole text file, i would like to do this kind of Job in a Shell file, is this possible? I couldnt find anything about this in the Documentation.
If not possible can anybody recommend alternative easy to use porgrams for this kind of Job?
Thank you
I haven't seen any documentation on doing this in Np++, but I am pretty sure you can do it in UltraEdit. This is not a free product, though.

How to perform multiple find and replace in TextMate besides macro?

I have several regular expressions to find and replace text in documents in TextMate. I would like to be able to have them run in a batch. I made a macro and it worked, but any tiny modifications to the macro means re-recording the macro. And I can't seem to modify the regex within the TextMate interface. It's read-only for some reason.
Can I make it into a command? Does anyone know how? I tried to read the TextMate help about commands, but it wasn't much help. It seems I need prior knowledge of shell scripts or some sort (which I have none). Any advise in the direction would be great.
Thanx in advance.
First, it's possible to edit macros. Since this is the easiest solution for you, here is how you do it:
Record a new Macro and save it in TheBundleOfYourChoice
Reload Bundles via "Bundles" > "Bundle Editor" > "Reload Bundles"
Open the file "~/Library/Application Support/TextMate/Bundles/TheBundleOfYourChoice.tmbundle/Macros/NameOfYourMacro.tmMacro" in TextMate (you can access any path - including hidden ones - if you press Command-Shift-G while in the "Open File" dialog)
Change the XML-representation of the Macro to your needs
Reload Bundles again
Use updated Macro
This solution may be the easiest for you, because it doesn't require you to learn a scripting language and should be OK for minor changes. However another very reasonable approach is choosing a scripting language of your choice and simply build a command, which runs your regular expressions. You can use perl, python, ruby, bash and so forth. A simple solution should be bash with sed. sed is a small tool, whose only purpose is to process text and should be ideal for you. bash is the default scripting langauge, so should be no problem either. You will figure it out somehow and learn a lot. Give it a try! :)

Mac-native text editor that can syntax-highlight diff files?

I do something like "svn diff > /mystuff/current.diff". I want to view this .diff file with syntax highlighting.
jEdit does it, but it's a huge beast and it takes a while to start up. I want something lightweight/native.
Smultron/Fraise, TextWrangler, TextEdit, Dashcode don't seem to highlight .diff files.
FileMerge seems to want to generate diff files, not show you existing ones.
TextMate does the trick, but it's not free. I'd feel happier dropping $50 US if I was going to take advantage of it for anything more than a diff viewer.
Are there any alternatives to jEdit or TextMate that I should consider?
You could try an OSX GUI for vim, like the full-featured MacVim or the lightweight vim-cocoa...
(For a rough feature comparison, you can see this mailing list comment comparing them...)
You might Versions, you can download a free demo version that will work for a limited time. You point it directly at you svn repository and you can compare versions.
http://www.versionsapp.com/
I currently use DiffMerge and it works really well for me. (I'm forced to use StarTeam and it integrates well with it)
Not an editor but you could use GIT or Mercurial and their Mac GUI clients to view the highlighted diffs in any files. The clients are free.
In a terminal, one can also use the command line version of vim (which I believe comes with the Xcode command-line developer tools).
Unfortunately, the command-line version of vim is not set up to do syntax highlighting by default, so there's a little bit of additional magic necessary.
For those not versed in vim, you need to know these three commands in order to view diff files:
vim <file> // open the file in vim
:syntax on // turn on syntax highlighting
:q // exit vim when you're finished
Vim is good at automatically recognizing diff files, so it's usually not necessary, but if for some reason vim doesn't recognize your diff as a diff, you can tell it which syntax to use:
:set syn=diff
If your diff is of source code, you might also occasionally want to toggle back and forth between syntax highlighting of the diff and syntax highlighting of the code; you can also set the syntax to java, c, php, mysql, or sh, among others.

How best to deal with gigantic source code files in Visual Studio

I'm working on a project which makes substantial use of code generation. Some of the files it generates contain >0.25 million lines of code. VS (2K5) doesn't cope too badly, but R# (4.01) throws an out of memory exception every two minutes or so.
Splitting them out into partial classes/separate files isn't an option in the immediate term, though it may be later.
Are there any clever IDE tricks to dealing with this?
EDIT: so people are immediately saying (very sensibly) 'don't have a file that big' and suggesting ways to break it out into smaller files.
That's fine, but I'm on a time-boxed task taking a look around and deciding what to optimise. My problem is very specifically 'how to view an insanely big file in an IDE without pain', not 'how to refactor the project'. For purposes of the question please imagine the file is read-only. :)
I would at least change huge files extention to something like .cpp_gen or .cpp_huge to remove syntax highlighting, outlining etc. and then reassign build tool back to C/C++ compiler tool for them.
Seems like this R# tool (is that Resharper?) is the problem. Can you disable it?
Otherwise, changing the file type for the generated code might make sense - presumably, you aren't going to be doing major editing on those files, so losing syntax coloring and other features specific to source files wouldn't be an issue.
WOW!
250 000 lines of code?
you should think not in a machine point of view, but in a human been point of view. Let's say that you want to pass that code to someone else, can you see the time to see what the code does?
Design Patterns were made to deal with this ind stuff, try to start small, refactoring it, then go deeper and start applying more D.P.
you will have less and less lines of code, and Yes, one of the best tricks is to separate into several files according to it's propose.
Assuming you're not hand-editing your generated code. (=BAD IDEA!!)
You could put the generated files in a separate solution that you compile from the command line and then reference those dll's from the project you're working in.
Is the problem when you open the file for editing in Visual Studio? I've noticed that VS editor can be quite slow and inefficient on large files. Also, you could try turning off certain options, e.g. word-wrapping kills my machine for some reason.
Otherwise you could use something else like Textpad with syntax highlighting installed to edit the problematic large source file... not as nice, for sure.
Don't use visual studio. There is too much going on in VS.
Since the file is read only, you wont be using any IDE features (Intellisense, Refactoring tools, formatting).
You will probably get better performance using a simpler application, such as notepad++ for simply viewing the file. Notepad++ will do standard language highlighting if you like color.
Can't you break up the files and use the preprocessor to bring them back together when you compile?
It must be possible somehow to group large chunks of those files in separate libraries. You'd then separate them into several projects. Tried this? What the is the current structure of your source code/ project?

Resources