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

Refactoring support #15569

Merged
merged 1 commit into from May 19, 2017

Conversation

Projects
None yet
3 participants
@RyanCavanaugh
Member

RyanCavanaugh commented May 3, 2017

Picks up where #14624 left off.

@RyanCavanaugh

This comment has been minimized.

Show comment
Hide comment
@RyanCavanaugh

RyanCavanaugh May 8, 2017

Member

Anyone want to take a look? The VS side is about to merge

Member

RyanCavanaugh commented May 8, 2017

Anyone want to take a look? The VS side is about to merge

@RyanCavanaugh RyanCavanaugh requested review from billti and mhegazy May 8, 2017

Show outdated Hide outdated src/compiler/types.ts
Show outdated Hide outdated src/server/protocol.ts
Show outdated Hide outdated src/server/protocol.ts
Show outdated Hide outdated src/services/codefixes/convertFunctionToEs6Class.ts
Show outdated Hide outdated src/services/codeFixProvider.ts
Show outdated Hide outdated src/services/codefixes/convertFunctionToEs6Class.ts
Show outdated Hide outdated src/services/codeFixProvider.ts
Show outdated Hide outdated src/services/refactorProvider.ts
Show outdated Hide outdated src/services/refactors/addAsyncSuffix.ts
Show outdated Hide outdated src/services/refactors/addAsyncSuffix.ts
Show outdated Hide outdated src/services/refactorProvider.ts
Show outdated Hide outdated src/services/refactors/addAsyncSuffix.ts
Show outdated Hide outdated src/services/refactors/addAsyncSuffix.ts
Show outdated Hide outdated src/services/refactors/addAsyncSuffix.ts
Show outdated Hide outdated src/services/refactors/addAsyncSuffix.ts
}
// all static members are stored in the "exports" array of symbol
if (symbol.exports) {

This comment has been minimized.

@mhegazy

mhegazy May 15, 2017

Contributor

Is this intended for a .ts or a .js file?

I think it is a .js file, since the binding for the special properties do not work in .ts files any way.

If my understanding is correct, then for static members we can not just add declarations for them, this will result in invalid .js class.

this also applies to the property declarations and assignments..

If we want this to work in a .ts file, then we need to do something with the inference to make it work first.

I would also recommend adding a check at the top of isApplicable to return if !inJavaScriptFile(node)

@mhegazy

mhegazy May 15, 2017

Contributor

Is this intended for a .ts or a .js file?

I think it is a .js file, since the binding for the special properties do not work in .ts files any way.

If my understanding is correct, then for static members we can not just add declarations for them, this will result in invalid .js class.

this also applies to the property declarations and assignments..

If we want this to work in a .ts file, then we need to do something with the inference to make it work first.

I would also recommend adding a check at the top of isApplicable to return if !inJavaScriptFile(node)

This comment has been minimized.

@mhegazy

mhegazy May 15, 2017

Contributor

also for member initialization, I wounder if we can even do these correctellly...

var c = function() { this.list.push(1); }
c.prototype.list = [];

is not the same as:

class c {
    constructor() { this.list.push(1); }
    list = [];

let a side that it is not valid JS strictly speaking.

@mhegazy

mhegazy May 15, 2017

Contributor

also for member initialization, I wounder if we can even do these correctellly...

var c = function() { this.list.push(1); }
c.prototype.list = [];

is not the same as:

class c {
    constructor() { this.list.push(1); }
    list = [];

let a side that it is not valid JS strictly speaking.

This comment has been minimized.

@RyanCavanaugh

RyanCavanaugh May 17, 2017

Member

Fixed these up. Non-func-expr things remain as assignments following the class body

@RyanCavanaugh

RyanCavanaugh May 17, 2017

Member

Fixed these up. Non-func-expr things remain as assignments following the class body

Show outdated Hide outdated src/services/services.ts
Show outdated Hide outdated src/services/refactorProvider.ts
Show outdated Hide outdated src/services/refactorProvider.ts
Show outdated Hide outdated src/services/refactorProvider.ts

@RyanCavanaugh RyanCavanaugh merged commit f489f5a into Microsoft:master May 19, 2017

4 checks passed

TypeScript Test Run typescript_node.4 Build finished.
Details
TypeScript Test Run typescript_node.6 Build finished.
Details
TypeScript Test Run typescript_node.stable Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@RyanCavanaugh RyanCavanaugh deleted the RyanCavanaugh:new_refactor branch May 19, 2017

export type GetApplicableRefactors = "getApplicableRefactors";
export type GetRefactorCodeActions = "getRefactorCodeActions";
export type GetRefactorCodeActionsFull = "getRefactorCodeActions-full";

This comment has been minimized.

@mhegazy

mhegazy May 19, 2017

Contributor

This should be marked as /* @internal */

@mhegazy

mhegazy May 19, 2017

Contributor

This should be marked as /* @internal */

export type RefactorCodeActions = {
actions: protocol.CodeAction[];
renameLocation?: number

This comment has been minimized.

@mhegazy

mhegazy May 19, 2017

Contributor

A comment here would be good.

@mhegazy

mhegazy May 19, 2017

Contributor

A comment here would be good.

program: Program;
newLineCharacter: string;
rulesProvider?: formatting.RulesProvider;
cancellationToken?: CancellationToken;

This comment has been minimized.

@mhegazy

mhegazy May 19, 2017

Contributor

why is this optional?

@mhegazy

mhegazy May 19, 2017

Contributor

why is this optional?

endPosition?: number;
program: Program;
newLineCharacter: string;
rulesProvider?: formatting.RulesProvider;

This comment has been minimized.

@mhegazy

mhegazy May 19, 2017

Contributor

why is this optional?

@mhegazy

mhegazy May 19, 2017

Contributor

why is this optional?

@mhegazy mhegazy referenced this pull request May 22, 2017

Closed

Pvb/refactorapi #11913

mjbvz added a commit to mjbvz/vscode that referenced this pull request May 23, 2017

Prototype TS/JS Refactoring Provider
Fixes #25739, from Microsoft/TypeScript#15569

Prototype of refactoring support for ts 2.4

@mhegazy mhegazy referenced this pull request May 24, 2017

Closed

Pvb/refactor/jsdoc #11951

@bryphe bryphe referenced this pull request Jun 4, 2017

Open

Refactoring Support #474

mjbvz added a commit to mjbvz/vscode that referenced this pull request Jun 12, 2017

Prototype TS/JS Refactoring Provider
Fixes #25739, from Microsoft/TypeScript#15569

Prototype of refactoring support for ts 2.4

mjbvz added a commit to mjbvz/vscode that referenced this pull request Jun 14, 2017

Prototype TS/JS Refactoring Provider
Fixes #25739, from Microsoft/TypeScript#15569

Prototype of refactoring support for ts 2.4

mjbvz added a commit to mjbvz/vscode that referenced this pull request Jun 16, 2017

Prototype TS/JS Refactoring Provider
Fixes #25739, from Microsoft/TypeScript#15569

Prototype of refactoring support for ts 2.4

mjbvz added a commit to Microsoft/vscode that referenced this pull request Jun 16, 2017

Prototype TS/JS Refactoring Provider (#27166)
* Prototype TS/JS Refactoring Provider

Fixes #25739, from Microsoft/TypeScript#15569

Prototype of refactoring support for ts 2.4

* Adding error reporting

* Updating for new API

* show quick pick for non-inlinable refactrings

ananthakumaran added a commit to ananthakumaran/tide that referenced this pull request Jul 8, 2017

ananthakumaran added a commit to ananthakumaran/tide that referenced this pull request Jul 30, 2017

@Microsoft Microsoft locked and limited conversation to collaborators Jun 14, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.