Skip to content

Add language configuration file for visual basic #118932

@OmriSoudry

Description

@OmriSoudry
  • VS Code Version: 1.51.1
  • OS Version: Windows_NT x64 10.0.17763

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Open a Visual Basic file (.vb)
  2. Type:
if True then
    ' Some code  
end if

Expected: When you type "End If", the indentation will go back to the same level as the opening block ("if"), as can be seen above.

Actual: The "end if" stays in the wrong indentation level:

if True then
    ' Some code  
    end if

Possible cause and solution:
I found out that this can happen in all programming languages where a closing tag includes the opening tag as a separate word (For example: If ... End If, or While ... End While).

Solution: This is related to the order of the pieces as defined in these lines of code in the richEditBrackets.ts file

  • If you change the order so that first the closing brackets would be pushed and only then the opening brackets, then it will work.
  • Alternatively, you can modify the createBracketOrRegExp function and just add a reverse() function there.

I'm not sure if it will mess things up or not (though my initial tests look promising) and I'm not too familiar with the code to change it myself and issue a PR, so please take a look and let me know what you think.

Thank you!

Metadata

Metadata

Labels

editor-autoindentEditor auto indentation issuesfeature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitiesinsiders-releasedPatch has been released in VS Code InsidersvisualbasicVisual Basic support issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions