Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java try-catch command color display problem #259

Closed
Power-tile opened this issue Nov 21, 2019 · 5 comments · Fixed by atom/language-java#217
Closed

Java try-catch command color display problem #259

Power-tile opened this issue Nov 21, 2019 · 5 comments · Fixed by atom/language-java#217
Assignees
Labels

Comments

@Power-tile
Copy link

Issue Type: Bug

In the try-catch argument in Java, when I use the operator | to catch for different exception types, the color gets weird when a new line is inserted in the middle of the exception sequences.

try {
process();
} catch (Exception1 | Exception2 | Exception3
| Exception4 | Exception5) { // this is where it gets weird - the catch became yellow and only two of the Exception classes became green
// handle the exception
}

图片

Extension version: 0.8.0
VS Code version: Code 1.40.1 (8795a9889db74563ddd43eb0a897a2384129a619, 2019-11-13T16:49:35.976Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.87GB (4.34GB free)
Process Argv C:\Users\Power_tile\Desktop\COMP2001 Programs\20191120\null-undefined.js
Screen Reader no
VM 0%
@akaroml
Copy link
Member

akaroml commented Nov 27, 2019

Thanks for reporting. @Vigilans please take a look. This is a syntax highlighting issue.
Also add @jdneo and @testforstephen for awareness.

@Vigilans
Copy link
Member

Vigilans commented Nov 27, 2019

This is duplicate of atom/language-java#205.

sadikovi pushed a commit to atom/language-java that referenced this issue Nov 27, 2019
### Description of the Change

Relax the too restrictive begin expression for catch block for following reasons:

* The begin pattern is not suitable for dealing with multi-line pattern.
* any comments between `catch` and `(` would also break the highlighting.

Leave the catch keywork be would just be fine, since syntax highlighting should only be responsible for happy path.

### Alternate Designs

Any other design would introduce new complexity.

### Benefits

* Can correctly highlight when caught exceptions are split in multiple lines
* Can correctly highlight when '(' is placed in a new line after `catch`
* Can correctly highlight when there is comment between `catch` and '('
* Reduces the complexity

### Possible Drawbacks

More like a `right` hightlight for wrong syntax in code.

### Applicable Issues

Fix #205 
FIx microsoft/vscode-java-pack#259
@Vigilans
Copy link
Member

Fixed in atom/language-java#217.

@Vlastimil157
Copy link

Issue Type: Bug

In the try-catch argument in Java, when I use the operator | to catch for different exception types, the color gets weird when a new line is inserted in the middle of the exception sequences.

try {
process();
} catch (Exception1 | Exception2 | Exception3
| Exception4 | Exception5) { // this is where it gets weird - the catch became yellow and only two of the Exception classes became green
// handle the exception
}

图片

Extension version: 0.8.0
VS Code version: Code 1.40.1 (8795a9889db74563ddd43eb0a897a2384129a619, 2019-11-13T16:49:35.976Z)
OS version: Windows_NT x64 10.0.18362

System Info

@Eskibear
Copy link
Member

image

Verified, it has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants