For some time now, when i hit cmd-/ (mac) in .php files it prints the comments for html,
and not for php.
so it does instead of //
the format is set to PHP, and it shows 'php' on the bottom right of the editor,
also all the syntax highlighting is fine.
any idea?
thanks :)
T
Sublime is decent, I prefer notepad++ and brackets for development. For your issue, uninstall than install Sublime in default, see if it works. If it does work, and you have custom plugins for it, add one at a time and test. To see what is causing the problem. If nothing is causing the problem and you have everything set to how you had it prior. I am guessing that some form of data corruption occured or the shortcut for a comment in php is mixed up with the comment in html. The text editor shouldn't be treating a completely different language as another. I hope this helped.
What commenting is done is based on the scoping rules. I'm not a PHP programmer so I might get some of the details wrong, but you should get the general idea. If I understand correctly, PHP files consist of a mix of HTML elements and PHP code blocks. ST allows for languages to be "embedded" within another file type (in this case, embedding HTML in the PHP syntax). If the cursor is in an html region, it will use HTML commenting. If it is a PHP region, it will use PHP commenting. I know there are some issues with edge cases, but try moving the cursor into the actual PHP code block, then using the comment command. You could probably find a modified language file that will just treat everything as PHP if you want.
To check the scopes begin applied, you can use the ScopeHunter plugin. Alternatively, you can use the ctrl+alt+shift+p in windows and linux or cmd+alt+p in osx to display the scope in the status bar.
I hope that helps clarify how commenting works. How you choose to actually "solve" this is up to you though, as it's more of a personal preference thing.
Related
I haven't used Processing in many years. I am copying some old code into Processing and it is pasting onto one line. Is there a beautify extension for Processing 3? Have looked and can't find.
What you're talking about is called auto-formatting, not beautifying.
The Processing editor includes an auto-formatter. Just go to Edit > Auto-Format, or press ctrl+t to do it from the keyboard.
Alternatively, most code IDEs like eclipse also include auto-formatters.
However, if everything is on one line, it sounds like you're dealing with an issue copying the newline character. This can happen if you copy something from one OS to another, for example. You might be able to google for a tool that fixes this problem, but it might be simpler to just put in the line breaks manually and then use the auto-formatter to handle the indentation for you.
Is there a text editor that will let me shade certain code blocks with specific colors so I can easily find them later? Bookmarks are great, but I also wanted to shade with the same color all code blocks which are somehow related to each other.
and
When my current text editors autocreate curly braces or parentheses for me and I type what I want in between them, are there any that let me either jump to the end of the line to put a semicolon there, or "return" to type the next line, or do I always have to use the arrow key to get out of the curly braces? Perhaps there is a shortcut I'm missing?
I think about every code editor, including Notepad++, has bookmarks. If you're looking for a more complete IDE, it probably depends on the language you're using. For .NET languages that is Visual Studio, but you probably would have known that. For PHP, Javascript and HTML/CSS, you can use Netbeans for PHP. Netbeans is also available for Java. It is a rich editor, and I think one of the best free general purpose IDE's available.
Marking pieces of code in colors is unknown to me. I've never seen an editor that supports this. You would also need a project in which to store the start and end points of these blocks, unless you would save them as comments or so in the file itself.
Visual Studio knows regions which you can define by a start tag and an end tag. You can collapse and unfold an entire region at once, making it quite easy to navigate through larger files.
But these regions are actually part of the code file, so you cannot use this for any file, because those region markers will probably make the file invalid.
I'm still wondering why any other shortcut key would be easier or more convenient than 'arrow down'..
For no apparent reason, it just stopped. No more color-coding. Is there a mystery setting I accidentally turned off?
I had the same problem and discovered it was because I had enabled global foreground color under Global Styles.
Try out the following:
Select a language manually from the "Languages" menu.
In Settings/Preferences, check the File Associatons.
In worst case, reinstall.
In the Language menu select your corresponding language. For example H and then html
The solution for me was to go into the Style Configurator, select the 'Global Styles' from the Language selection box and uncheck the 'Enable global foreground colour' option. I am not sure why that was checked, but all of the code coloring worked after unchecking it. Thanks Richard!
Have a look in Settings -> Style Configurator. Maybe your styles got messed up somehow. You could try changing the selected style to see if it makes a difference.
I think the saved styles are stored in the "themes" directory under your Notepad++ installation directory, so you could also check that the files have not become corrupted in some way.
I had the same problem (I Googled "notepad++ file coloring quit" to find this discussion.) In my case the coloring quit mid file in a single file. I finally realized that adjacent string literals with one of them a macro was fooling Notepad++.
My code that broke it read:
Write_Supplemental_Configuration(privateData->new_config, FTP_ROOT_DIR"/lists.csv");
and the fix was to add a space after the macro:
Write_Supplemental_Configuration(privateData->new_config, FTP_ROOT_DIR "/lists.csv");
I tried replacing the macro FTP_ROOT_DIR with "foo" and the problem went away.
So in my case it was a macro that fooled the Notepad++ coloring.
watch out for the single quote that you copy from the web. if you get one of those "upper commas" instead of the tic mark it will confuse the code and kill the coloring (in SQL). just delete and replace.
Make sure that when you save the file it's saved as an .html instead of a .txt. This make a difference because the .html allows you to see the different colour codes whereas .txt doesn't.
Check, if you have saved the documents as .HTML and not as .txt
in the menu, choose Settings>Style configurator...
and in the list in the left pan select html, check if the colors for different tags are being shown in the color blocks. if yes, chosse a font and then save and exit.
Check only after you save the document in .html, whether it is working or not.
The language setting solved the issue for (all) 3 Javascript files (.js) which suffered from it, which previously were all recognized correctly as Javascript. For some reason it forgot they were Javascript files apparently!?
First type any thing and Save the file in any format you are working with (i-e; .cpp if c++, .js if JavaScript....etc)
And make sure global foreground color is disabled.
And it should work fine.
File > Save As > Format Type = Structured Query Language > Name the file with '*.sql'. THIS SHOULD BRING ALL THE COLOR CODES.....to differentiate your code and make it look pretty. J
If you want to display text in SQL format, then in menu select Language => S => SQL
Got to Setting -> Style Configuration and remove the global style checkbox
I just had the same thing happen to me. The only way I could fix it was to rename the file (I just added one character). Then open it with notepad++. The code was colored again. Then renamed the file back to the original name and it is still colored.
I have since found that if I close Notepad++ without closing the file first this happens. Try closing the file first then close Notepad++ then reopen the file.
This bug seems to be fixed as of version 7.8.6
If the coloring only stopped working for one file, you should check the extension name of your file. You might have accidentally saved the file as .txt
A couple years late here, but I'm pretty sure you're opening ".txt" files that contain your source code. Because the file doesn't have the language's extension, Notepad++ can't determine how to color-code it. You'll have to select the language under the "Language" tab.
I have a question but not sure it is possible or not.
I am using apache logger for my logging which creates a log file which works fine with no issues. My question is when I open the log file I get the different messages like messages with INFO,DEBGU,ERROR etc.
But I want to see the error message in red color in text in my logger file. Is this possible?
That way, if someone opens my log file and something is there in red they can clearly guess that it is an error message..
Is this possible?
I would really appreciate if someone can respond.
Thanks, Swati
Which text editor do you use to open the log file? Notepad, Notepad++, UltraEdit, SlickEdit, or one of the many, many text editors out there? By default, you can't. There might some text editors that allows you to write some kind of extension or plugin to provide custom syntax highlighting. That's an option you take.
Having said that, if some one else open using his/her text editor, and without your plugin, they of course won't see the red color coded lines.
I'll be honest and say I know nothing about the apache logger you're talking about.
Log files are typically plain text, purely for the reason that other programs can parse them. Will you use HTML, or RTF to markup the log? If so, what happens if you have a programmer like me who does not care about formatting?
Short Answer: yes it's possible.
Long Answer: but you'll have to add the appropriate markup, and you'll have to assume the user has the correct application to view said markup. In the end, this might cause more problems than its worth: If your end user is a programmer reading the log file, then formatting is usually superfluous. If your end user is a normal non-technical person, consider other means of notifying them of errors.
You could just use a logviewer.
I'm looking for something like CSS for code. Does it exist either in an IDE, or as a plugin?
The compiler often doesn't care how many more spaces or tabs or newlines you have between tokens in your code, but people do care.
I want to specify in my "style sheet" that braces always live on a seperate line, commas are always followed by spaces, and spaces always surround operators.
Somebody else could then take my code and in their style sheet, specify that no unnecessary spaces should be visible, braces should always be on the same line as their predecessor, and functions should always be separated by 3 line breaks. But the code itself should not actually change.
Is there such a tool?
I don't think such a thing exists, the best solution is to have a custom style for local coding (most IDE's allow this) and then use a tool to reformat your source code (like Jalopy for Java) when you commit it centrally.
That way you have something that's common centrally, but can still style how you want locally.
I don't know of any tool that can arbitrarily apply a style to code without actually modifying the text itself. Since you need to edit the code, that seems impractical.
This is called code formatting and if you google "code formatter" and your language of choice you should get a list of available options.
Try some eclipse based IDE (Aptana) or eclipse itsefl and and from there you can configure how the formatting works :)