zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.52k stars 3.02k forks source link

JSX comment line not work true #18213

Open TalhaAksoy opened 1 month ago

TalhaAksoy commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

when press crtl + / shortcut comment line syntax wrong in jsx

import "./App.css";

const data = [
    {
        name: "asd",
        age: 12,
    },
    {
        name: "abc",
        age: 13,
    },
];

function App() {
    console.log(data[0].name);
    return (
        // <>
        //     <div>
        //         <span></span>
        //     </div>
        // </>
    );
}

export default App;

Environment

System: Kernel: 6.1.0-25-amd64 arch: x86_64 bits: 64 compiler: gcc v: 12.2.0 Desktop: GNOME v: 43.9 Distro: Debian GNU/Linux 12 (bookworm) Machine: Type: Laptop System: LENOVO product: 20RA005GTX v: ThinkPad E14 serial: Mobo: LENOVO model: 20RA005GTX serial: UEFI: LENOVO v: R16ET33W (1.19 ) date: 09/15/2021 Battery: ID-1: BAT0 charge: 38.6 Wh (99.0%) condition: 39.0/45.7 Wh (85.4%) volts: 12.2 min: 11.1 model: Celxpert 01AV448 status: not charging CPU: Info: quad core model: Intel Core i5-10210U bits: 64 type: MT MCP arch: Comet/Whiskey Lake note: check rev: C cache: L1: 256 KiB L2: 1024 KiB L3: 6 MiB Speed (MHz): avg: 750 high: 800 min/max: 400/4200 cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 400 8: 800 bogomips: 33599 Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx Graphics: Device-1: Intel CometLake-U GT2 [UHD Graphics] vendor: Lenovo driver: i915 v: kernel arch: Gen-9.5 bus-ID: 00:02.0 Device-2: AMD Lexa [Radeon 540X/550X/630 / RX 640 E9171 MCM] vendor: Lenovo driver: amdgpu v: kernel arch: GCN-4 bus-ID: 03:00.0 temp: 51.0 C Device-3: Chicony Integrated Camera type: USB driver: uvcvideo bus-ID: 1-8:3 Display: wayland server: X.Org v: 1.22.1.9 with: Xwayland v: 22.1.9 compositor: gnome-shell driver: X: loaded: amdgpu,modesetting unloaded: fbdev,radeon,vesa dri: iris gpu: i915 resolution: 1: 1920x1080~60Hz 2: 1920x1080~60Hz API: OpenGL v: 4.6 Mesa 22.3.6 renderer: Mesa Intel UHD Graphics (CML GT2) direct-render: Yes Audio: Device-1: Intel Comet Lake PCH-LP cAVS vendor: Lenovo driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 API: ALSA v: k6.1.0-25-amd64 status: kernel-api Server-1: PipeWire v: 0.3.65 status: active Network: Device-1: Intel Comet Lake PCH-LP CNVi WiFi driver: iwlwifi v: kernel bus-ID: 00:14.3 IF: wlp0s20f3 state: up mac: Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Lenovo RTL8111/8168/8211/8411 driver: r8169 v: kernel port: 2000 bus-ID: 04:00.0 IF: enp4s0 state: down mac: IF-ID-1: br-55653762a45f state: down mac: IF-ID-2: docker0 state: down mac: Bluetooth: Device-1: Intel AX201 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 1-10:5 Report: hciconfig ID: hci0 rfk-id: 1 state: up address: bt-v: 3.0 lmp-v: 5.2 Drives: Local Storage: total: 119.24 GiB used: 81.36 GiB (68.2%) ID-1: /dev/nvme0n1 vendor: SK Hynix model: BC711 NVMe 128GB size: 119.24 GiB temp: 32.9 C Partition: ID-1: / size: 114.9 GiB used: 81.18 GiB (70.6%) fs: ext4 dev: /dev/dm-0 mapped: alha--vg-root ID-2: /boot size: 455.1 MiB used: 179.6 MiB (39.5%) fs: ext2 dev: /dev/nvme0n1p2 ID-3: /boot/efi size: 511 MiB used: 11.9 MiB (2.3%) fs: vfat dev: /dev/nvme0n1p1 Swap: ID-1: swap-1 type: partition size: 980 MiB used: 1.2 MiB (0.1%) dev: /dev/dm-1 mapped: alha--vg-swap_1 Sensors: System Temperatures: cpu: 58.0 C pch: 54.0 C mobo: N/A gpu: amdgpu temp: 50.0 C Fan Speeds (RPM): fan-1: 0 fan-2: 0 Info: Processes: 333 Uptime: 23m Memory: 7.57 GiB used: 4.84 GiB (64.0%) Init: systemd target: graphical (5) Compilers: gcc: 12.2.0 clang: 14.0.6 Packages: 2834 Shell: Bash v: 5.2.15 inxi: 3.3.26

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


manojbajaj95 commented 1 month ago

I am facing same issue on MacOS as well.

AkisKourouklis commented 1 month ago

It seems to me that the error only exist on the top level div. For example if you try to comment anything inside the top level div it works.

function App() {
  console.log(data[0].name);
  return (
    <div>
      {/* <div>
        <span></span>
      </div> */}
    </div>
  );
}

But on both jsx and tsx file if you try to comment the top level div in doesn't work. For example as you can see here I only commented the top level div and did it wrong, the same applies if I try to comment the entire component inside the return ()

function App() {
  console.log(data[0].name);
  return (
    // <div>
      <div>
        <span></span>
      </div>
    </div>
  );
}

I believe it has something to do with lsp and not the editor itself. The lsp usually informs the program what syntax to use.

TalhaAksoy commented 1 month ago

It seems to me that the error only exist on the top level div. For example if you try to comment anything inside the top level div it works.

function App() {
  console.log(data[0].name);
  return (
    <div>
      {/* <div>
        <span></span>
      </div> */}
    </div>
  );
}

But on both jsx and tsx file if you try to comment the top level div in doesn't work. For example as you can see here I only commented the top level div and did it wrong, the same applies if I try to comment the entire component inside the return ()

function App() {
  console.log(data[0].name);
  return (
    // <div>
      <div>
        <span></span>
      </div>
    </div>
  );
}

I believe it has something to do with lsp and not the editor itself. The lsp usually informs the program what syntax to use.

the comment line is only wrong when taken at the top element