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

Fix bug with "every funk" in private class function #22

Closed
pokey opened this issue Jun 24, 2021 · 2 comments
Closed

Fix bug with "every funk" in private class function #22

pokey opened this issue Jun 24, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@pokey
Copy link
Member

pokey commented Jun 24, 2021

Here's a file that triggers the error. Say "take every funk" when cursor is in private function at the bottom


import * as vscode from "vscode";
import { join } from "path";
import { COLORS } from "./constants";
import { SymbolColor } from "./constants";

export type DecorationMap = {
  [k in SymbolColor]?: vscode.TextEditorDecorationType;
};

export interface NamedDecoration {
  name: SymbolColor;
  decoration: vscode.TextEditorDecorationType;
}

export default class Decorations {
  decorations: NamedDecoration[];
  decorationMap: DecorationMap;

  constructor() {
    const iconWidth = "1rem";
    const iconPath = join(__dirname, "..", "images", "hat.svg");

    this.decorations = COLORS.map((color) => ({
      name: color,
      decoration: vscode.window.createTextEditorDecorationType({
        // borderStyle: "solid",
        // borderColor: new vscode.ThemeColor(`cursorless.${color}Border`),
        // borderWidth: "2px 0px 0px 0px",
        // borderRadius: "4px",
        // backgroundColor: new vscode.ThemeColor(`cursorless.${color}Background`),
        rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
        after: {
          margin: `-1rem 0 0 -${iconWidth}`,
          width: iconWidth,
          height: iconWidth,
          color: new vscode.ThemeColor(`cursorless.${color}Border`),
          contentIconPath: iconPath,
        },
      }),
    }));

    this.decorationMap = Object.fromEntries(
      this.decorations.map(({ name, decoration }) => [name, decoration])
    );
  }
  private constructWrapperSvg() {
    const svg = `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M19 13H5v-2h14v2z"/></svg>`;
    return vscode.Uri.parse(`data:image/svg+xml;utf8,${svg}`);
  }
}
@pokey pokey changed the title Fix bug with every Fix bug with "every" Jun 24, 2021
@pokey pokey added the bug Something isn't working label Jun 24, 2021
@pokey pokey changed the title Fix bug with "every" Fix bug with "every funk" Jul 6, 2021
@pokey pokey changed the title Fix bug with "every funk" Fix bug with "every funk" in private class function Jul 6, 2021
@pokey
Copy link
Member Author

pokey commented Jul 22, 2021

Not sure if related but the following doesn't work:

class TestCase {
  talonCommand!: string;

  extractPrimitiveTargetKeys() {}
}

If you say "take funk" with your cursor in extractPrimitiveTargetKeys, you get an error Cannot read property 'type' of null.

Strangely the following works so maybe it's just a tree-sitter error

class TestCase {
  talonCommand: string = "";

  extractPrimitiveTargetKeys() {}
}

@pokey
Copy link
Member Author

pokey commented Jan 8, 2022

All of these things now work for me, so they were probably fixed when @AndreasArvidsson was hacking on our typescript pattern matchers 👍👍

@pokey pokey closed this as completed Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant