if then not indenting properly in vb

Syntax highlighting, code folding, brace matching, code indenting, and function list

if then not indenting properly in vb

Postby doubledrat » Sat Apr 21, 2007 9:39 am

hi

trying to get indenting working with

1.

if x then y

rather than

2.
if x then
y
endif

I've tried telling ue to only indent on "then$" but it seems to do it no matter where the string is found. any way around this?
User avatar
doubledrat
Newbie
 
Posts: 2
Joined: Fri Apr 20, 2007 11:00 pm

Re: if then not indenting properly in vb

Postby Mofi » Sat Apr 21, 2007 12:11 pm

Have you used the Preview before pressing the button Submit?

I don't think so, look on your post. Use BBCode tags
Code: Select all
[color=green]your code block[/color]
when you want to post a code block with spaces as indent character.

Regular expression characters like $ can be used only in the function strings and nowhere else (except Member and Variable strings for the IDE of UEStudio).

See also the forum topic indenting only when a character is at end of prior line?

By the way: What do you use - UltraEdit or UEStudio - and which version?

Look in help of UE or UES on the Index tab if you can find the page Artistic Style Formatter dialog. This help page about the tool Artistic Style contains near the bottom of the page the description about the 4 main indent styles ansi, Kernighan&Ritchie, linux and gnu. If you compare the 4 styles, you will see the differences and then maybe you can tell us what is the style you would prefer for Visual Basic. The 4 indent styles are also explained at the homepage of Artistic Style. To know which style you prefer could be helpful on your question.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: if then not indenting properly in vb

Postby doubledrat » Sat Apr 21, 2007 1:48 pm

I don't really care which style. I just don't want ue 11 to do this

Code: Select all
if x then y
  next line indented


this scenario is fine
Code: Select all
if x then
  y
endif
User avatar
doubledrat
Newbie
 
Posts: 2
Joined: Fri Apr 20, 2007 11:00 pm

Re: if then not indenting properly in vb

Postby Mofi » Mon Apr 23, 2007 8:24 am

Now I understand. But there is no solution for that problem. UE doesn't know if the text following indent string "Then" is the code which belongs to the If condition and so the next line should not be indented.

If it would be possible to specify that an indent string must be on the end of a line, then this would not be a problem. But this is not possible. Write a feature request email to IDM support. But such a limitation would mean you must take care never to have trailing spaces/tabs or a line comment after "Then" when the code is on the next line or UE would be flexible enough to handle this also when the limitation with end of line is active.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: if then not indenting properly in vb

Postby vhdluser » Thu May 10, 2007 8:27 pm

dr: Yep, you+ue have a problem. UE syntax highlighting engine seems to be designed for white space insensitive syntaxes. It will fail in your case. Nice try with the $; regular expressions cannot be used for defining syntax tokens. I run into this myself. :cry:
User avatar
vhdluser
Basic User
Basic User
 
Posts: 23
Joined: Tue Jan 30, 2007 12:00 am

Re: if then not indenting properly in vb

Postby Dawk » Tue Jun 10, 2008 3:56 am

I have if sentences indenting properly in UE 14.

Simple if statements do not indent:

Code: Select all
  If bStatus Then bStatus=File_CopyFile(gsRoot & "\Files\UV-Data.RDP", gsFiles & "\UV-Data.RDP", False)
  Custom=bStatus


but if ... end if do indent:

Code: Select all
  If bStatus And (sClientDir<>"") Then
    Set oLocalFSO = CreateObject("Scripting.FileSystemObject")
    sCmd = oLocalFSO.OpenTextFile(sClientDir & "\Lib\" & sScriptFile,1).ReadAll
  Else
    bStatus=False
  End If


What I did was: I removed "Then" from the /Indent line and added "If" instead, and then I remove "End" from /Unindent, adding "End Function", "End If", "End Sub", "End Select", and "End With", thus ending up with:

Code: Select all
/Indent Strings = "If" "Select Case" "Do While" "Do Until" "Else" "ElseIF" "Do" "<td>" "<tr>"
/Unindent Strings = "Next" "End Function" "End If" "End Select" "End Sub" "End With" "Loop" "Loop While" "Else" "ElseIF" "</TD>" "</tr>"
User avatar
Dawk
Newbie
 
Posts: 5
Joined: Fri Feb 09, 2007 12:00 am
Location: Denmark


Return to Syntax Highlighting