Visual Studio 2017 JavaScript Language Service has been disabled - visual-studio-2017

While editing JavaScript source files in Visaul Studio 2017, the following error keeps occuring:
The JavaScript language service has been disabled for the following project(s): ...
Even if I disable the JavaScript language service entirely, the error keeps occuring. Why is this happening and how do I stop this error message from displaying all the time? Can I disable the JavaScript language service entirely?

The solution to the problem was simply to use a tsconfig.json file, even though there were only JavaScript files in my solution.
I've just used the following tsconfig.json file in the root of the project:
{
  "compileOnSave": true,
 "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "sourceMap": true,
    "target": "es2015",
    "module": "amd",
    "allowJs": false,
    "allowSyntheticDefaultImports": true
  },
  "exclude": [
    "lib",
    "node_modules"
  ]
}

open 'developer command line tool for visual studio'. run :
devenv.exe /resetuserdata

Related

Error in Running Django tests in visual studio

My tests are running fine in terminal but while trying to run tests in visual studio i got error of :
Error of django.core.exceptions.AppRegistryNotReady: Apps aren't loaded
My Visual studio Folder settting file is:
"python.pythonPath": "/home/aditya/Maximl/Blast4/Server/syncopsenv/bin/python3.6",
"python.unitTest.pyTestEnabled": false,
"python.unitTest.nosetestsEnabled": false,
"python.unitTest.unittestEnabled": true,
"python.unitTest.debugPort": 3000,
"python.unitTest.autoTestDiscoverOnSaveEnabled": true,
"python.unitTest.pyTestArgs": ["."],
"python.unitTest.unittestArgs": ["-v", "-s", ".", "-p", "*test*.py"]
}
Visual Studio doesn't go via python manage test. So you need to explicitly call django.setup() first. See here

Django/Visual Studio Tutorial - objects method error

I'm working through the Django Tutorial (here). I'm using visual studio on a Mac and VS keeps showing an error on this code:
latest_question_list = Question.objects.order_by('-pub_date')[:5]
The error reads Class 'Question' has no 'objects' member.
The example builds a Questions Class which in fact doesn't directly have an objects member, but the code runs fine and I think that there is a built in member within Django that has objects.
So that leads me to believe that the visual studio debugger is raising an error that doesn't actually exist.
Is there a way to fix this?
I've looked through preferences/setting and under extensions to see if there is a plugin or setting reference that could be made to Django to clear the error within Visual Studio - I didn't see anything.
That is not error, just a warning from the Visual Studio Code. objects is a Manager instance which is added to our model classes dynamically by django. When VS Code checks the class declaration, it do not found objects declaration there, so warns us about a possible error.
In, Visual Studio code, python extension uses pylint as default linter.
To work it properly you can install pylint locally as:
pip install pylint
Or, you can also disable linting by configuring the following property in either one of (User or Workspace settings file) as follows:
"python.linting.enabled": false
For django projects, you can customize the pylint plugin by modifying the User or Workspace settings as follows:
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"]
For anyone who gets "Expected comma" error in User Settings, put comma to previous argument and after this one "python.linting.pylintArgs": ["--load-plugins", "pylint_django"]
Must be like this:
{
"python.pythonPath": "C:\\Program Files (x86)\\Python37-32\\python.exe",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"[python]": {
},
"python.linting.pylintArgs": [
"--load-plugins", "pylint_django"
],
}

Turning off "Language Service Disabled" error message in VS2017

We are getting the following "Error" message in our MVC web application in Visual studio 2017 Enterprise.
The language service is disabled for project 'C:\Work\Blackhawk
Platform\Platform-DEV-Branch\BlackhawkViewer\BlackhawkViewer.csproj'
because it included a large number of .js files. Consider excluding
files using the 'exclude' section of a 'tsconfig.json' file.
I have tried turning off the Language service in the options but this does not turn the message off:
This is a rather large web application. Is there a way to turn this message off without disabling any files in the tsconfig.json file as it suggests?
To solve this issue do the following:
Create file in root directory of your project and call it tsconfig.json
Add this:
{
"compilerOptions": {
"allowJs": true,
"noEmit": true,
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"include": [
"scripts"
],
"exclude": [
],
"typeAcquisition": {
"enable": true
}
}
Please have a look at the below two links for tsconfig.json explanation, because you may still need to change it according to your setup. This is the only way that worked for me. I hope that will help.
https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
https://developercommunity.visualstudio.com/content/problem/8148/javascript-intellisense-not-working.html
This helped me. You can have a try.
Go to Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service -> General
and uncheck the box: "Enable the new JavaScript language service.
I have found a solution for this problem.
I reset my userData using:
devenv.exe /resetuserdata
Since doing this the JavaScript settings seem to have persisted and I no longer get the language service error above.
TAKE NOTE: This will reset all your user data and customisations.
In My case I just disable TypeScript support on Visual Studio:
Tools > Extensions and Updates > TypeScript for Microsoft Visual Studio > Disable
After that, just restart Visual Studio, and you are good to go.
Hope this will help,
I had the same problem after migrating Ionic 1 project from VS2015 to VS2017, first I executed git clean -fxd as sugested above and added this content into tsconfig.json in my ionic project.
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules",
"www",
"bower_components"
]
}
I solved this problem with following solution:
When you have a JavaScript file that is included in the project.csproj file but isn't in the project folder, this error occurred.
For example I have a .csproj file like below:
<ItemGroup>
<Content Include="Scripts\Test.js" />
</ItemGroup>
The Test.js is included in the .csproj file, but it isn't in the Scripts folder:
Delete the <Content Include="Scripts\Test.js" /> line from the .csproj file and rebuild your project
Solution that worked for me:
Go to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>.
Open command prompt as admin in current folder
Ran devenv /Setup
Ran devenv /ResetSkipPkgs
For me is helping the next solution. I've create a tsconfig.json file in root of the my project with "disableSizeLimit": "true" option.
So, my tsconfig.json file is:
{
"compilerOptions": {
"disableSizeLimit": "true"
},
"exclude": []
}
If none of suggested methods worked, try:
npm install -g typescript#latest
and then
Install the latest version of TypeScript for Visual Studio on Get TypeScript.

How to debug typescript in Ionic2

I use typescript in my Ionic 2 project . How to debug my typescript files ? I try to without webpack file , But it is not a good solution for that !!Can you help me ?
To debug your application, use the keyword debugger in your code which will set the break point
function myBrokenFunction() {
debugger;
// do other stuff
}
Check here for details
WebStorm / InteliJ Supports Typescript debugging. it is using a chrome extension and allow you to put breakpoints in the IDE.
This blog post also covers it
If visual debugging is more your style you could checkout Batarangle, an Angular2 take on the Batarang browser plugin.
If you are using webpack as the app bundler, instead of rollup , try to create a file on your project's root , webpack.config.js , and write this content:
module.exports = {
devtool: 'source-map'
}
In your typescript config file tsconfig.json, yuo must have the entry :
"sourceMap": true

MSB4018 The "ResolveComReference" task failed unexpectedly

I am currently trying to upgrade our c++ mfc solution from visual studio 2010 to a visual studio 2013 solution. When i try to build it i get the error MSB4018 The "ResolveComReference" task failed unexpectedly. I enabled fusion logging and this is what it tells me:
=== Pre-bind state information ===
LOG: DisplayName = System
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. ===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.EXE.
I understand that msbuild has been moved, but i dont understand why it is trying to find System.dll in the msbuild path, how can i make it look for it in its proper location?
Edit:
I have now also tried upgrading to visual studio 2012 which worked without bigger problems and I did not run into the same problem. However i noticed that when running devenv /upgrade (with vs2013) it seems to completely change everything under vc++ directories (it stayed unchanged when upgrading to vs2012). Could this have something to do with this issue?
Edit2:
Tried to build the project in vs2013 after upgrading it to 2012 (without running devenv /upgrade), this also didnt work so I guess the problem is not related to that...
After enabling diagonostic build output i found that it was 3 broken COM references in the project that where failing to load. Removing these references solved the building issue. These where only showing up as warnings in vs2010 but resulted in MSB4018 in vs 2013 for some reason.
This is your problem:
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
Fix the base folder in your build system if you really need it to point to another filder. However it would probably be better to redo you build system targeting 2013 instead of patching the 2010 version.