Diagnostics
The DIAGNOSTICS panel lists every problem the compiler reports in the project: errors, warnings, hints and information messages. The panel is docked at the bottom of the default layout. View → DIAGNOSTICS shows it.
The four kinds
| Kind | Colour |
|---|---|
| Error | Red |
| Warning | Yellow |
| Information | Blue |
| Hint | Green |
At the right of the title bar, four counters show how many problems of each kind the project has. The counters always count everything, whatever is shown in the list below.
Each counter is also a switch. Click it to show or hide the problems of that kind. Errors and warnings are shown at first. Hints and information are hidden. The pointer tooltip of a counter reads, for example, Total Error Count -> click to toggle on/off. The IDE keeps the four switches for each project, and brings them back when you reopen it.
The commands tbProblems_ToggleShowErrors, tbProblems_ToggleShowWarnings, tbProblems_ToggleShowHints and tbProblems_ToggleShowInfos flip the same switches. They have no keys by default.
The list
The list has one group for each file that has a problem to show. The group’s header is the file’s name, and pointing at it shows the path. Click the arrow at the left of the header, or double-click the header, to collapse or expand the group.
Under a header, each row is one problem. A row shows an icon for its kind, the code and the message, and the position in square brackets as [line,column]. The code is TB and four digits, such as TB0012. When the compiler gives no code, the row shows TB5000. Pointing at a row shows its message in full.
Go to a problem
Click a row to select it. Two buttons appear under the row:
- Jump to issue
- Opens the file at the line and column of the problem, and puts the focus in the code.
- Help
- Shows only the message Online help content coming soon.
A double-click on a row does the same as Jump to issue.
Copy problems
Right-click in the list for a menu of five items. The menu is in English whatever the IDE language is.
- Copy
- Copies the row under the pointer.
- Copy All
- Copies the rows that are shown. A kind that is switched off is not copied.
- Copy All Errors
- Copies the errors only.
- Collapse all, Expand all
- Collapse or expand every group.
A copied row reads {ERROR} or {WARNING}, the path of the file, the position, and the code and message. Copy All and Copy All Errors begin with a line that names the IDE: twinBASIC ( and the version, then ) compilation error report:.
Note BETA 1042
Each copied message contains the HTML tag <span>TBnnnn</span> around the code, and Copy All labels hints and information messages {WARNING}. Remove the tags from the pasted text by hand.
In the code
A problem also shows in other places:
-
The editor underlines the part of the code the problem refers to with a wavy line. Hover over it to see the message, as
TBnnnn:and the text. -
The tab of the file is tinted, and so is its row in the Project Explorer. The tint follows the worst problem in the file.
-
Alt+F8 and Shift+Alt+F8 move through the problems of the current file; see Navigating.
Common errors
Most errors are explained on the page of the statement, type or feature they concern, and a search for the code finds that page. These four come from code of every kind. Each is shown with the message it gives for an example.
- TB5079, Unrecognized symbol ‘Undefined1’
- Nothing the code can reach declares the name. It is misspelt, it is a variable that was never declared while Option Explicit is on, it is Private to another module, or it belongs to a package or library that the project does not reference. For a project imported from VB6, see Why do I see a lot of errors saying my variables are unrecognized?. For a type name, as in
Dim t As NoSuchType, the message is Unrecognized datatype symbol ‘NoSuchType’. - TB5001, cannot coerce datatype LongLong to Long. Explicitly call CLng() if necessary.
- A value has a type that twinBASIC does not convert to the type needed unless the code says so, such as a LongLong assigned to a Long. For an argument the message is Validation of call to ‘TakesLong’ failed. Argument for ‘n’: cannot coerce type ‘LongLong’ to ‘Long’, which in a 64-bit build is also what a LongPtr passed for a Long parameter gives. Write the conversion out with CLng or another conversion function; see the conversions of LongLong and LongPtr.
- TB5027, Unrecognized member ‘NoSuchMember’ on type ‘_Collection’ [non-extensible object]
- The name after a dot is not a member of the type or module before it, or is a member that is Private to it. For a module the message is [Other] does not contain ‘Hidden’, or it is inaccessible in this context.
- TB5182, Syntax error. No handler for this symbol
- A statement or an attribute where the language does not allow it. A line at the top level of a
.twinfile, outside a Module or Class block, is one case. An attribute written where it does not apply is another.
Note BETA 1042
For a type name, TB5079 reads Unrecognized symbol ‘Unrecognized datatype symbol ‘NoSuchType’’: the message for a type is put inside the message for a name.
See Also
- Navigating – move from problem to problem in the editor
- IntelliSense – hover shows a problem’s message
- Compiler Warnings – every warning, by its code