User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Syntax highlighting, code folding, brace matching, code indenting, and function list
4 posts Page 1 of 1
I have removed all of the "P" .uew files except 'powershell.uew' in my C:\users\<username>\AppData\Roaming\IDMComp\UltraEdit\wordfiles. When I open a .ps1 file, the default 'View as language' automatically sets to 'Ruby'. It seems to skip over the powershell.uew file. If I remove all of the .uew files except PowerShell, it will set the 'View as language' to PowerShell. If I add all of the uew files back to the directory, the 'View as language' will default to Python.

Is there any way to set the default language (uew file) for a specific extension?
Do you use the user contributed powershell.uew file as available for download from the wordfiles download page?

I just looked into this file with first line being

Code: Select all
/L17"PowerShell" PS_LANG Nocase EnableMLS Line Comment = # Line Comment Alt = # Block Comment On = <# Block Comment Off = #> Escape Char = `\ String Chars = "' File Extensions = PS1 ps1 PSM1 psm1 psd1 PSD1 EnableSpellasYouType

There are several mistakes in this line and there are also other mistakes in the file. I have quickly fixed the mistakes I could see or which my macros reported. Try the wordfile in the attached ZIP archive.

If you still have issues as *.ps1 files are highlighted with wrong language, please compress entire wordfiles folder into a ZIP or RAR archive and attach this archive file to your next post. I will look into the files and fix them to get *.ps1 files highlighted by default with PowerShell language as expected. A PowerShell script file added also to the archive file for testing would be in this case also useful for me.

Attachments

Best regards from Austria
All of the uew files were downloaded from http://www.ultraedit.com/downloads/extras/wordfiles.html

I also included a generic powershell script that I tried and still get Python. See the screen shot below (later removed).

Thank you for the quick response!

Edit: Archive with my wordfiles deleted.
Okay, a quick look on the set of wordfiles helped to understand why you get different and unexpected behavior on syntax highlighting.

First, the file c.uew uses UNIX line termination instead of DOS line terminations. Please open this file in UltraEdit, convert the file from UNIX/MAC to DOS, save and close this file.

Second, I added the space character twice to the list of delimiters in updated powershell.uew. This minor issue is fixed in newly uploaded ZIP file in previous post.

Third, some file extensions like ASP, ASA, CPP, ... are assigned to multiple syntax highlighting definitions in multiple wordfiles. This results in an undefined behavior on which syntax highlighting from which wordfile is applied after opening a file with an extension multiple assigned in the wordfiles. To solve this issue you have to decide which wordfile should be preferred for example for *.cpp files. Remove file extension CPP from all other wordfiles. A wordfile without File Extensions = is no problem (must be always manually selected), but a file extension assigned to multiple languages is a problem. Another solution would be merging the definitions of all wordfiles used to syntax highlight the same type of file together to a single wordfile. It should be no problem to define the various groups for variants with 20 syntax highlighting groups per wordfile.

Fourth, many language markers like C_LANG and XML_LANG can be used in multiple wordfiles in same wordfiles directory. But those language markers used for multi-language syntax highlighting of "HTML" files (web content defining files) must be uniquely used in all wordfiles of a wordfiles directory. The (multi-language) syntax highlighting is undefined if there are multiple files containing HTML_LANG or ASP_LANG. For details see the post Multi-language syntax highlighting for HTML files. And two language markers in same file is complete nonsense as in aspjscript.uew. The solution should be merging the definitions together to one file for each language marker which must be unique in set of wordfiles and use for example ASP_LANG only in the single wordfile for ASP whereby the file extension ASP should be nevertheless specified in html.uew except your *.asp files contain always only ASP code and never HTML code or code of other languages.

UltraEdit syntax highlighted by luck the *.ps1 file as defined in powershell.uew on my machine on first opening. But an undefined behavior caused by specifying a file extension to multiple languages and having multiple wordfiles with same language marker which must be unique means an unpredictable syntax highlighting. I got the *.ps1 file highlighted as ASP JScript according to aspjscript.uew as I restarted UltraEdit, opened some wordfiles, created the data below in a new file and and opened now the *.ps1 file. Also another *.ps1 file opened next and just containing 4 lines to test the function string was syntax highlighted with ASP JScript. Undefined behavior = unpredictable behavior = not expected behavior.

Here is a list of your wordfiles with the file extensions and the language markers. This should help you to determine how to solve the multiple file extension specifications and multiple usage of language markers which must be unique in the user set of wordfiles.

Code: Select all
aspjscript.uew: ASP_LANG and HTML_LANG
File Extensions = ASP ASA

aspvb.uew: HTML_LANG
File Extensions = ASP ASA

aspvbscript.uew: HTML_LANG
File Extensions = vsp vsa

aspx.uew: ASP_LANG
File Extensions = ASPX

c.uew: C_LANG
File Extensions = C CPP H HPP AWK

c_cplusplus.uew: C_LANG
File Extensions = C CPP CC CXX H HPP AWK

c_cplusplus_objc.uew: C_LANG
File Extensions = C CPP CC CXX H HPP AWK M

cppsource.uew: C_LANG
File Extensions = CPP

csharp.uew: CSHARP_LANG
File Extensions = CS

css.uew: CSS_LANG
File Extensions = CSS

doxyfile.uew:
File Extensions = DO2 DOXYFILE

html.uew: HTML_LANG
File Extensions = HTM HTML SHTML HTT HTA HTX CFM JSP PHP PHTML ASP TMPL ASAX ASHX ASMX ASPX ASCX

java.uew: JAVA_LANG
File Extensions = JAV JAVA

javascript.uew: JSCRIPT_LANG
File Extensions = JS

js20.uew: JSCRIPT_LANG
File Extensions = JS

jscript.uew: JSCRIPT_LANG
File Extensions = JS ASP

JSON.uew:
File Extensions = JSON

lotusscript5.uew:
File Extensions = LS LSS

mssql2k.uew:
File Extensions = SQL TQL

mssql7.uew:
File Extensions = SQL

perl.uew: PERL_LANG
File Extensions = CGI PL PM PLX

php.uew: PHP_LANG
File Extensions = PHP3 PHP4 PHP5

powershell.uew:
File Extensions = PS1 PSM1 PSD1

python26.uew: PYTHON_LANG
File Extensions = PY PYW

ruby.uew: RUBY_LANG
File Extensions = rb rbw

vb.uew: HTML_LANG
File Extensions = BAS FRM CLS VBS ASP INC

vbdotnet.uew: VB_LANG
File Extensions = BAS FRM CLS VBS ASP INC VB

vbscript.uew: ASP_LANG
File Extensions = VBS

visualbasic.uew: VB_LANG
File Extensions = BAS FRM CLS VB VBA CTL DSR

xml.uew: XML_LANG
File Extensions = XML XUL XSD XSL XSLT WSDL CONFIG SSS

xmlschema.uew: XML_LANG
File Extensions = XSD

Please ask for help if something is not clear or you need my help to get a better set of syntax highlighting wordfiles.
Best regards from Austria
4 posts Page 1 of 1
cron