octref / polacode

📸 Polaroid for your code
https://marketplace.visualstudio.com/items?itemName=pnp.polacode
6.82k stars 183 forks source link

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

Open 2catycm opened 2 years ago

2catycm commented 2 years ago

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
2catycm commented 2 years ago

image

2catycm commented 2 years ago

image

2catycm commented 2 years ago

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 2 years ago

i have the same problem.

SlavenDj commented 2 years ago

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.

2catycm commented 2 years ago

Thanks for your help. So the problem is that some content is confusing the plugin, not that there are excessive lines.  By the way,as the plugin is discontinued, would you like to recommand an excellent new plugin about code capturing? 

---Original--- From: @.> Date: Tue, Aug 23, 2022 03:04 AM To: @.>; Cc: @.**@.>; Subject: Re: [octref/polacode] When there are many lines of code, the buttondoesn't react. (Issue #172)

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.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

SlavenDj commented 2 years ago

Im using Codesnap: https://marketplace.visualstudio.com/items?itemName=adpyke.codesnap