#StackBounty: #javascript #typescript #visual-studio-code #console.log #vscode-debugger vscode debugger with typescript: what determine…

Bounty: 50

I’m using vscode to write some typescript, and I have set a breakpoint. When I open the Debug pane and ask it to evaluate an object, what is it doing to produce the string representation?

The reason I am asking is because I am using this solution to control the way that console.log renders an instance of a class, and it works great — but it doesn’t seem to impact the way the object is rendered in the debugger.

To be more specific, the below code (also available in the typescript sandbox here) results in the desired output from console.log. However, when I set a breakpoint just before the console.log line and evaluate myObj in the debugger, what’s displayed is

cls {property: 'property', hello: 'override', newProperty: 'new property'}

rather than

Greeter3Generated {property: 'property', hello: 'override', newProperty: 'new property'}

Code in question:

function classDecorator3<T extends { new (...args: any[]): {} }>(
  constructor: T
) {
  const cls = class extends constructor {
    newProperty = "new property";
    hello = "override";
  };
  Object.defineProperty(cls, 'name', {
    get: () => `${constructor.name}Generated`
  });
  return cls
}

@classDecorator3
class Greeter3 {
  property = "property";
  hello: string;
  constructor(m: string) {
    this.hello = m;
  }
}

const myObj = new Greeter3("world")
console.log(myObj);
//=>  Greeter3Generated: { "property": "property", "hello": "override", "newProperty": "new property" } 


Get this bounty!!!

#StackBounty: #macos #emacs #visual-studio-code #comments Adding Emacs-style trailing line comment in Visual Studio Code

Bounty: 50

I am trying to replicate a standard comment shortcut from Emacs in Visual Studio Code (MacOS).

In Emacs, the shortcut M-; adds a trailing line comment to the current line. I use this shortcut quite a lot to comment on parts of the code.

For example, when editing a Matlab script in Emacs, the code

A=2*pi*radius;

becomes after pressing M-;

A=2*pi*radius;                          % |  

where | is the position of the cursor. Is there any way to replicate this behaviour in Visual Studio Code?


Get this bounty!!!

#StackBounty: #emacs #visual-studio-code #comments Adding Emacs-style trailing line comment in Visual Studio Code

Bounty: 50

I am trying to replicate a standard comment shortcut from Emacs in Visual Studio Code.

In Emacs, the shortcut M-; adds a trailing line comment to the current line. I use this shortcut quite a lot to comment on parts of the code.

For example, when editing a Matlab script in Emacs, the code

A=2*pi*radius;

becomes after pressing M-;

A=2*pi*radius;                          % |  

where | is the position of the cursor. Is there any way to replicate this behaviour in Visual Studio Code?


Get this bounty!!!

#StackBounty: #angular #typescript #visual-studio-code #tsconfig #tsconfig-paths VSCode / tslint does not resolve paths in tsconfig.json

Bounty: 100

vscode is somehow not honoring my tsconfig.json (for a couple of weeks now, it has been different. eiter my bad or vscode update…)

{
"compileOnSave": false,
"compilerOptions": {
    "baseUrl": "./",
    "paths": {
        "@foo-animation/*": [
            "src/app/animation/*"
        ],
        ...

enter image description here

Respectively in the Problems tab:

Cannot find module ‘@foo-animation/animation-micro’ or its corresponding type declarations. ts(2307)

Regular base paths (like @angular/core) are properly resolved, just my ‘custom’ ones are the problem…

Compiling, Building, Running… all works like a charm. So I believe from an angular/typescript-perspective everything is fine. (Also, my fellow developers using IntelliJ have no issues…) So it seems to boild down to „telling vscode (or tslint within) about it“…. :-/

My tsconfig.json sits in the root-folder of the project. the only thing is, that I use another tsconfig.app.json, which includes above tsconfig.json.

enter image description here

So is there a way to tell vscode (resp. tslint) where to look for it’s tsconfig.json (to encourage parsing those paths) ?

This SO question and this VSCode github issue might be related, but I still don’t know what to do.


Get this bounty!!!

#StackBounty: #php #visual-studio-code Rename refactoring for PHP in Visual Studio Code

Bounty: 100

Is there a rename refactoring for PHP in Visual Studio Code? It is the only thing that stops me from fully move from NetBeans to VSC. Renaming is very importat for me (not search/replace).

When I rename local variable (let say $sum) it should change the name only in the scope where that local variable was defined, not all variables named $sum in the same file or across all files.


Get this bounty!!!