Skip to content

JavaScript LS scaffolding + JS module inference - #5266

Merged
Ryan Cavanaugh (RyanCavanaugh) merged 14 commits into
masterfrom
javaScriptModules
Nov 10, 2015
Merged

JavaScript LS scaffolding + JS module inference#5266
Ryan Cavanaugh (RyanCavanaugh) merged 14 commits into
masterfrom
javaScriptModules

Conversation

@RyanCavanaugh

Copy link
Copy Markdown
Member

This is a subset of the prior PR that carves out only the code we need to get a) JavaScript intellisense in general and b) CommonJS module inference in JavaScript files.

Includes work by Vladimir Matveev (@vladima) in 'services' to get the correct compilation context to Roslyn

Comment threadsrc/services/services.ts Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting this out into a function.

functionshouldRecordAmdDefineName(index: number,moduleName: string){// record first item in the list only if its name is not "require"// record second item in the list only if its name is not "exports"// record third item in the list only if its name is not "module"// record all other items in the list unconditionallyswitch(index){case0:
returnmoduleName!=="require";case1:
returnmoduleName!=="exports";}returnindex!==2||moduleName!=="module";}

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the AMD logic entirely

Comment threadsrc/compiler/checker.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think you need the declaration.parent.kind test. There should never be a case where that isn't true.

Comment threadsrc/compiler/binder.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually put a blank on both sides of the | operator.

@RyanCavanaugh

Copy link
Copy Markdown
MemberAuthor

Vladimir Matveev (@vladima) can you address the comments in program.ts?

# Conflicts:
#	tests/webTestServer.ts
# Conflicts:
#	lib/lib.es6.d.ts
#	lib/tsc.js
#	lib/tsserver.js
#	lib/typescript.d.ts
#	lib/typescript.js
#	lib/typescriptServices.d.ts
#	lib/typescriptServices.js
#	src/compiler/binder.ts
#	src/compiler/checker.ts
#	src/compiler/parser.ts
#	src/compiler/program.ts
#	src/harness/fourslash.ts
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@RyanCavanaugh@DanielRosenwasser@ahejlsberg@vladima@msftclas