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

experimentalDecorators in tsconfig.json stops working for new files #38201

Closed
limbosounds opened this issue Nov 13, 2017 · 13 comments
Closed

experimentalDecorators in tsconfig.json stops working for new files #38201

limbosounds opened this issue Nov 13, 2017 · 13 comments
Assignees
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@limbosounds
Copy link

limbosounds commented Nov 13, 2017

  • VSCode Version: Code 1.18.0 (dcee220, 2017-11-08T12:44:48.751Z)
  • OS Version: Linux x64 4.4.0-98-generic
  • Extensions:
Extension Author (truncated) Version
aurelia Aur 0.3.4
vscode-docker Pet 0.0.21
sass-lint gle 1.0.0
azure-account ms- 0.2.2
sass-indented rob 1.4.5
vscode-multiclip sle 0.1.3

(22 theme extensions excluded)


I have a file tsconfig.json in my project folder with next content:

{
	"compilerOptions": {
		"target": "es6",
		"jsx": "react",
		"experimentalDecorators": true,
		"allowJs": true
	}
}

When I create a file and add a row with decorator (e.g. @observable field), VSCode underlines it with warning about experimental support of decorators. When I restart VSCode, the problem disappears until I create a new file.

@vscodebot vscodebot bot added the typescript Typescript support issues label Nov 13, 2017
@mjbvz mjbvz added the info-needed Issue requires more information from poster label Nov 13, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Nov 13, 2017

Please try running the TypeScript: Go to project configuration command in the new file. Does this open up the correct tsconfig?

@limbosounds
Copy link
Author

@mjbvz excuse me, how should I do it? :)

@limbosounds
Copy link
Author

@mjbvz well, I did it and got an info toast with File is not part of a TypeScript project

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 14, 2017

What does your project structure look like? Where is the tsconfig and where is the file in relation to it?

@limbosounds
Copy link
Author

limbosounds commented Nov 14, 2017

screenshot from 2017-11-14 20-31-56

@mjbvz The file is in src/components/<whatever>, also got bug with src/views/<whatever>. Today I noticed that this bug happened not only and not always with new files. E.g. it appears for first-time opened files.

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 14, 2017

Are you working in a javascript or jsx file?

@limbosounds
Copy link
Author

@mjbvz jsx

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 14, 2017

Can you try renaming your tsconfig.json to a jsconfig.json and also adding an explicit includes property so that only js files in src are included:

{
	"compilerOptions": {
		"target": "es6",
		"jsx": "react",
		"experimentalDecorators": true
	},
	"include": ["./src/**/*"]
}

@limbosounds
Copy link
Author

@mjbvz I did it. After this I created a new folder named 123, then created file index.jsx inside it. Inside index.jsx I entered an example code:

import React from 'react'
import { observable } from 'mobx'

export default class Ololo extends React.Component {
	@observable ololo
	render() {
		return <div></div>
	}
}

The problem still exist with the same behaviour.

@drew-r
Copy link

drew-r commented Nov 15, 2017

I encountered this issue on a new file also.
My tsconfig.json is not in the root directory of the workspace, which may be an aggravating factor.

Typescript: Go to Project Configuration returns File is not part of a TypeScript project.

Other files in the project do not exhibit the same behaviour and the project config command takes me to tsconfig as expected.

Edit: Changing the typescript version back and forth between workspace & vscode, reloads something that fixes.

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 16, 2017

Can you make sure the jsconfig uses include instead of includes. The example I originally pasted up was incorrect.

Also, please collect the TypeScript server logs to see if that has any leads:

  1. Add "typescript.tsserver.log": "verbose" to your user settings and restart VSCode.
  2. Reproduce the issue
  3. Run the Typescript: Open TS Server log command in vs code and look in the tsserver.log file in the opened directory

Look for errors or stack traces. If you are able to share the logs, I can also look through them to see if anything stands out

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

@limbosounds
Copy link
Author

@mjbvz I did all of your recomendations. At the end of day I created folder /src/model_workers/ChatWorkers and a file MessageWorker.js inside. Got the issue. The last rows inside tsserver.log is (private paths simplified):

Info 49174[17:47:43.3] event:
    {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":6215}}
Info 49175[17:47:43.117] request:
    {"seq":6216,"type":"request","command":"getApplicableRefactors","arguments":{"file":"/<simplified_path>/src/model_workers/ChatWorkers/MessagesWorker.js","startLine":5,"startOffset":2,"endLine":5,"endOffset":2}}
Info 49176[17:47:43.117] Starting updateGraphWorker: Project: /dev/null/inferredProject2*
Info 49177[17:47:43.117] Finishing updateGraphWorker: Project: /dev/null/inferredProject2* structureChanged: false Elapsed: 0ms
Perf 49178[17:47:43.118] 6216::getApplicableRefactors: elapsed time (in milliseconds) 0.6422
Info 49179[17:47:43.118] response:
    {"seq":0,"type":"response","command":"getApplicableRefactors","request_seq":6216,"success":true,"body":[]}
Info 49180[17:47:53.983] request:
    {"seq":6217,"type":"request","command":"occurrences","arguments":{"file":"/<simplified_path>/src/model_workers/ChatWorkers/MessagesWorker.js","line":4,"offset":13}}
Info 49181[17:47:53.983] Starting updateGraphWorker: Project: /dev/null/inferredProject2*
Info 49182[17:47:53.986] Finishing updateGraphWorker: Project: /dev/null/inferredProject2* structureChanged: false Elapsed: 0ms
Perf 49183[17:47:53.992] 6217::occurrences: elapsed time (in milliseconds) 8.8734
Info 49184[17:47:53.992] response:
    {"seq":0,"type":"response","command":"occurrences","request_seq":6217,"success":true,"body":[{"start":{"line":1,"offset":10},"end":{"line":1,"offset":20},"file":"/<simplified_path>/src/model_workers/ChatWorkers/MessagesWorker.js","isWriteAccess":true},{"start":{"line":4,"offset":3},"end":{"line":4,"offset":13},"file":"/<simplified_path>/src/model_workers/ChatWorkers/MessagesWorker.js","isWriteAccess":false}]}
Info 49185[17:47:54.207] request:
    {"seq":6218,"type":"request","command":"getApplicableRefactors","arguments":{"file":"/<simplified_path>/src/model_workers/ChatWorkers/MessagesWorker.js","startLine":4,"startOffset":2,"endLine":4,"endOffset":13}}
Info 49186[17:47:54.207] Starting updateGraphWorker: Project: /dev/null/inferredProject2*
Info 49187[17:47:54.207] Finishing updateGraphWorker: Project: /dev/null/inferredProject2* structureChanged: false Elapsed: 0ms
Perf 49188[17:47:54.208] 6218::getApplicableRefactors: elapsed time (in milliseconds) 0.4328
Info 49189[17:47:54.208] response:
    {"seq":0,"type":"response","command":"getApplicableRefactors","request_seq":6218,"success":true,"body":[]}
Info 49190[17:47:54.208] request:
    {"seq":6219,"type":"request","command":"getCodeFixes","arguments":{"file":"/<simplified_path>/src/model_workers/ChatWorkers/MessagesWorker.js","startLine":4,"startOffset":2,"endLine":4,"endOffset":13,"errorCodes":[1219,1146]}}
Info 49191[17:47:54.208] Starting updateGraphWorker: Project: /dev/null/inferredProject2*
Info 49192[17:47:54.208] Finishing updateGraphWorker: Project: /dev/null/inferredProject2* structureChanged: false Elapsed: 0ms
Perf 49193[17:47:54.208] 6219::getCodeFixes: elapsed time (in milliseconds) 0.2070
Info 49194[17:47:54.208] response:
    {"seq":0,"type":"response","command":"getCodeFixes","request_seq":6219,"success":true,"body":[]}

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 21, 2017

Thanks. I believe this is a duplicate of microsoft/TypeScript#20023 . As a workaround, try downgrading your workspace to TS 2.5

Closing as upstream

@mjbvz mjbvz closed this as completed Nov 21, 2017
@mjbvz mjbvz added upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed info-needed Issue requires more information from poster labels Nov 21, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants