octref/polacode

When there are many lines of code, the button doesn't react.

2catycm opened this issue · 7 comments

Example code I want to capture:

import java.util.Scanner;

public class HilbertCurve {
    public static int w[][] = {{0,0,0},
                               {0,1,4},
                               {0,2,3}};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int x = in.nextInt();
        int y = in.nextInt();

        System.out.println(HilbertNumber(n, x, y));
        in.close();
    }

    public static long HilbertNumber(int n, int x, int y) {
        if (n == 1)
            return w[x][y];

        /*base code:
        * if (n == 0) return 1;
        * is better. because w1 can be divided to 1*1 squares */

        int m = 1 << (n - 1);
        if (x <= m) {
            if (y <= m) {
                return HilbertNumber(n - 1, y, x);//Part 1,coordinates offset:0; flip: x’ = y  y’=x�
            } else {
                return m * m + HilbertNumber(n - 1, x, y - m);//Part 2, coordinates offset: y-m �
            }
        } else {
            if (y > m) {
                return 2 * m * m + HilbertNumber(n - 1, x - m, y - m);//Part 3, coordinates offset: x-m y-m
            } else {
                return 3 * m * m + HilbertNumber(n - 1, m + 1 - y, m + 1 - (x - m));//Part4, coordinates offset: x=x-m; flip: x’ = m+1-y,  y’ = m+1-x�
            }
        }

    }
}

When I try to use the plugin, it does not react with the code above.
However, if I just select

public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int x = in.nextInt();
        int y = in.nextInt();

        System.out.println(HilbertNumber(n, x, y));
        in.close();
    }

It works.
VSCode settings:

Font size: 18
Font Family: Consolas, 'Courier New', monospace
theme: cyberpunk

VSCode version:

版本: 1.66.2 (user setup)
提交: dfd34e8260c270da74b5c2d86d61aee4b6d56977
日期: 2022-04-11T07:46:01.075Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Windows_NT x64 10.0.22000

I didn't see a issue like this, and I didn't see a documentation that says too many lines of code is not supported, so I wonder if this is a bug.

rictt commented

i have the same problem.

I was testing something, and found out %10.2 makes that bug in print fun. Try deleting line by line to see what the problem is. Taking a screenshot of the preview is the only solution right now. I feel like this extension is discontinued.