izhangzhihao / intellij-rainbow-brackets

🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio/Fleet
https://plugins.jetbrains.com/plugin/10080-rainbow-brackets
GNU General Public License v3.0
4.39k stars 206 forks source link

[IDEA-328501] Support semantic highlighting for Dart / Support Rainbow Variables for Dart #2741

Closed Locter9001 closed 4 days ago

Locter9001 commented 1 month ago

Have you checked the issues and discussions to ensure there are no duplicates?

Yes

Your programming languages

Dart

Free or paid?

Paid users

Expected Behavior

Dart variables color

Code snippet for test

import 'package:flutter/material.dart';
import 'dart:io';

class WiFiSerialCommunication extends StatefulWidget {
  @override
  _WiFiSerialCommunicationState createState() => _WiFiSerialCommunicationState();
}

class _WiFiSerialCommunicationState extends State<WiFiSerialCommunication> {
  Socket? _socket;

  void connectToDevice(String ip, int port) async {
    try {
      _socket = await Socket.connect(ip, port);
      print('Connected to: ${_socket!.remoteAddress.address}:${_socket!.remotePort}');

      // Listen for responses from the server
      _socket!.listen((data) {
        print('Received: ${String.fromCharCodes(data)}');
      });
    } catch (e) {
      print('Failed to connect: $e');
    }
  }

  void sendMessage(String message) {
    if (_socket != null) {
      _socket!.add(utf8.encode(message));
    }
  }

  @override
  void dispose() {
    _socket?.close();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Wi-Fi Serial Communication'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              onPressed: () {
                connectToDevice('192.168.1.100', 23); // Replace with your device IP and port
              },
              child: Text('Connect to Device'),
            ),
            ElevatedButton(
              onPressed: () {
                sendMessage('Hello Device');
              },
              child: Text('Send Message'),
            ),
          ],
        ),
      ),
    );
  }
}

Your Environment

Android Studio Koala | 2024.1.1 RC 1 Build #AI-241.15989.150.2411.11887322, built on May 25, 2024 Runtime version: 17.0.10+0--11609105 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 3072M Cores: 20 Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true terminal.new.ui=true Non-Bundled Plugins: com.intellij.marketplace (241.15989.199) Dart (241.17502) izhangzhihao.rainbow.brackets (2024.2.4-241) io.flutter (79.2.3) cn.yiiguxing.plugin.translate (3.6.1)

izhangzhihao commented 1 month ago

I made some searches, I found that: IDEA-328501 Support semantic highlighting for Dart opened 7 years before.

So, without IDE's support, I can only do rule-based syntax highlighting, similar issues may happen like #2709

Currently, a modified version:

image

intellij-rainbow-brackets-2024.2.4-241.zip