Giter Club home page Giter Club logo

nodejstools's Introduction

Node.js tools for Visual Studio

Node.js tools for Visual Studio is developed and managed here.

Build status for master branch Join the chat at https://gitter.im/Microsoft/nodejstools

Check out our documentation on the NTVS wiki

Feel free to file issues or ask questions on our issue tracker, and we welcome code contributions - see Contributing for information.

Visual Studio 2019 installation

The Node.js development workload is available as part of Visual Studio 2019 Community, Professional and Enterprise. To install, run the normal VS installer and select the Node.js development workload.

If you have VS and need to add the Node.js development workload follow this documentation

Visual Studio 2017 installation

For Visual Studio 2017 Community, Professional and Enterprise, run the 2017 VS installer and choose the Node.js development workload. Please note you will need a Visual Studio Subscription to access this.

If you have VS and need to add the Node.js development workload follow this documentation

Visual Studio 2015 and earlier

For more information on how to install Node.js tools, please send an email to Gabrielle Crevecoeur (Current Program Manager)

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

Apache License 2.0 (Apache)

Thank you for using and supporting the Node.js Tools for Visual Studio.

nodejstools's People

Contributors

amcasey avatar aozgaa avatar armanio123 avatar avitalb avatar bartread avatar billti avatar crwilcox avatar csigs avatar dependabot[bot] avatar dtretyakov avatar int19h avatar jcansdale avatar joj avatar kant2002 avatar minestarks avatar mjbvz avatar mousetraps avatar nareshjo avatar ozyx avatar paulvanbrenk avatar rachelgshaffer avatar rickwinter avatar ryancavanaugh avatar safacero avatar sanyamc-msft avatar shenniey avatar uniqueiniquity avatar yugangw-msft avatar zhengbli avatar zooba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejstools's Issues

breakpoint hit multiple times

var http = require('http');
var port = process.env.port || 1337;
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' }); <- set breakpoint here
    res.end('Hello World\n');
}).listen(port);

For some reason this breakpoint is hit three times for me when I load the page. Does this repro for anyone else?

Is there a way to view console output?

When running the startup project/file, is there a way to view console (stdout/stderr) output? Ideally it would display in "Output:Debug", or "Output:Tests" in the case of tests. Tests do seem ti have an output view that is visible when clicking on "Output" for the highlighted test, but there is no way to view this as you are debugging, making it usefulness limited.

Is there currently a way to view this?

JSHint and JSCS errors off by 1 line

Using the Web Essentials I find that the error/warning line numbers are off by one in the JSHint and JSCS error output window. For example the following code (line 1 in the editor)

var http = require('http')

gives this error (note line number is 2)

Message 1   JsHint (W033): Missing semicolon.   C:\Users\Steve\documents\projects\NodejsWebApp1\NodejsWebApp1\server.js 2   28  

Double clicking on the error does got to the correct line in the source so it's just the displayed line number that is off by one

Debugging from a webpage

Hi,
I have a Node.js project that is intended to be used for a website HTML5 + canvas.
Inside his node_modules there is a nested reference to "domify" (turn HTML into DOM elements)

While debugging require(), the next error is displayed, beacuse (of course) no "document" element exists, I am starting from a javascript:

Debugger listening on port 5858
D:\xxx\node_modules\min-dom\node_modules\domify\index.js:12
var div = document.createElement('div');
^
ReferenceError: document is not defined
at Object. (D:\xxx\node_modules\min-dom\node_modules\do
mify\index.js:12:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (D:\xxx\node_modules\min-dom\lib\domify.js:1
:80)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Press any key to continue...

The question is, how can I start the debugger from a webpage in order to have a "document" and pass this error?

Thank you

Specifiy browser to launch

It would be useful to specify which browser is launched when the 'Start web browser on Launch" is set. It currently uses the default browser but my default browser is FIrefox but I need for IE better integrated client debugging (as far as I can tell I need to get IE to invoke a second copy of VS for client debugging in VS)

Debugging sort of works again when AD7Thread stops throwing exception for IDebugThread2.CanSetNextStatement

Hi

First of all very happy about the work! I know you guys have stopped looking at Visual Studio 2012 but I have still not yet upgraded. So hence my question. Not bug.

I noticed the debugging did not hit breakpoints anywhere when using latest with NodeJs. Switched to io.js and still nothing. Desperate to see if I could get this to work I managed to track it down to a NotImplementedException being thrown out of the AD7Thread's implementation of IDebugThread2.CanSetNextStatement.

When I traded out throw for return 0; the break points started getting hit again after I recompiled and re-installed the plugin locally.

Is the answer to upgade VS latest or is this something that could be accommodated going foward? Any info on what the future of the debugging interface would use would also be great to know.

After an error building the project VS is not longer able to run the app

After running the app correctly for the first time. I pressed "restart" to run the app again after doing some changes. The build failed with this message:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Node.js Tools\Microsoft.NodejsTools.targets(93,37): error MSB4023: Cannot evaluate the item metadata "%(FullPath)". The item metadata "%(FullPath)" cannot be applied to the path "..\..\..\Projects\myproject\\node_modules\prova\node_modules\watchify\node_modules\browserify\node_modules\insert-module-globals\node_modules\combine-source-map\node_modules\inline-source-map\node_modules\source-map\lib\source-map\basic-source-map-consumer.js". C:\Users\Miguel\Projects\myproject\node_modules\prova\node_modules\watchify\node_modules\browserify\node_modules\insert-module-globals\node_modules\combine-source-map\node_modules\inline-source-map\node_modules\source-map\lib\source-map\basic-source-map-consumer.js
Done building project "MyProject.njsproj" -- FAILED.

Build FAILED.

After that I try to run the project (not restart) and the project build just fine. But it not longer runs node.exe and I'm not able to debug the project.

I have to restart VS to make it work again.

I'm using NTVS 1.0 under Visual Studio 2013 Community Edition.

Visual Studio crashes on exception.

I'm trying to use generators with harmony enabled. When I try to run the program from Visual Studio it crashes with this error. If I run it directly from node at the command-line it doesn't give me any errors. I don't seem to be able to catch this exception.

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: read ECONNRESET
    at exports._errnoException (util.js:746:11)
    at TCP.onread (net.js:559:26)

[Discussion] Copy build to output folder

I'm trying to copy the results of a build to an output folder as part of our build scripts
I've tried setting

    <BaseIntermediateOutputPath>C:\Out</BaseIntermediateOutputPath>
    <IntermediateOutputPath>C:\Out</IntermediateOutputPath>
    <OutputPath>C:\Out</OutputPath>

but have had none of the js code or modules copied
I know earlier versions used to drop to the bin folder but that's no longer the case

How would I tell my njsproj to copy to a specific output folder?

VS2015 F5 is inconsistent

Oftentimes it doesn't go any further than "debugger listening on port 5858"

(using basic express app)

Make the error message clearer in the REPL window for .npm command

When you have a solution with multiple projects and you try to install npm packages from the REPL window, the error prompt for the .npm command wrt the poject name part is miss leading. We should change it from:

Please specify a valid Node.js project or project directory in solution. If solution contains multiple projects, specify target project using .npm [ProjectName or ProjectDir] <npm arguments>

to something like:

Please specify a valid Node.js project or project directory in solution. If solution contains multiple projects, specify target project using .npm [ProjectName or ProjectDir] (with the brackets) <npm arguments>

For loops indent comments when they shouldn't

Format Below:

function f() {
    for(var i = 0; i<0; i++)
    /*
    var x;
    var y;
     */
    var z;
    var w;
}

Expect:

function f() {
    for(var i = 0; i<0; i++)
    /*
    var x;
    var y;
     */
        var z;
    var w;
}

Actual:

function f() {
    for (var i = 0; i < 0; i++)
        /*
    var x;
    var y;
     */
        var z;
    var w;
}

As part of fixing this it would likely be good to inspect the same for if statements, etc.

Test Case to add to TestFor() in FormatterTests

            // For loop incorrectly indents comment instead of line
            TestCode(
@"function f() {
    for(var i = 0; i<0; i++)
    /*
    var x;
    var y;
     */
    var z;
    var w;
}",
@"function f() {
    for(var i = 0; i<0; i++)
    /*
    var x;
    var y;
     */
        var z;
    var w;
}");
        }

[from codeplex https://nodejstools.codeplex.com/workitem/1577]

ESLint integration

I like VS scrollbar markers and I like the highly configurable/pluggable ESLint, so I would love to see it integrated.

F10 stops on last line of file

If there is a line of code on the last line of a file, it will appear as if F10 doesn't do anything when trying to F10 over that line the first time.

If there is whitespace on the last line of a file, when F10'ing the prior non-empty line, we will stop at that last line.

for reference, When we F10 again, it'll goto the end of module.js.

The 'MRU Package' package did not load correctly.

Hi,

I try to install nodejs tools in visual studio 2013 update 3 and I am getting the following error. Any idea why?

The 'MRU Package' package did not load correctly.

I uninstalled Nodejs tools solved the problem.

Thanks for the help.

Permit loading custom modules in the Interactive Window

The interactive window is a very nice feature. It's great that I'm able to test out NodeJS code on the fly.

This request is to associate the interactive window with a particular project in Visual Studio. This would permit loading custom modules defined in that project.

At present this works:

var x = require('fs');

but this doesn't

var x = require('htmlParser2')
// Error: Cannot find module 'htmlParser2'

NB: I have installed htmlParser2 in one of the NTVS projects, but not all of them.

Need to provide ability to execute custom .npm scripts

Would like the ability to define custom .npm scripts to execute in the interactive window or some extensiblity point.

Think of the package manager console in the way you can defined a new PS command by simply adding a PS1 file to a package that gets installed.

Wrong indentation

var docdbClient = require('documentdb').DocumentClient;

module.exports = {
    getOrCreateDatabase: function (client, databaseId, callback){
        var querySpec = {
            query: 'SELECT * FROM root r WHERE r.id=@id',
            parameters: [
                {
                    name: '@id',
                    value: databaseId,
                }
            ]
        };
        // TODO
    },

    getOrCreateCollection: function (client, databaseLink, collectionId, callback){
        var querySpec = {
            query: 'SELECT * FROM root r WHERE r.id=@id',
            parameters: [
                {
                    name: '@id',
                    value: collectionId,
                }
            ]
        };

        client.queryCollections(databaseLink, querySpec).toArray(function (err, results) {
            if (err) {
                callback(err);
            } else {
                if (results.length === 0) {
                    var collectionSpec = {
                        id: collectionId
                    };

                    client.createCollection(databaseLink, collectionSpec, function (err, created) <<< HERE

                }
            }
        });
    }
};

Where it says <<< HERE, type an open curly brace { and hit enter.
The cursor will go on the next line at wrong indentation (it will be indented too much).

Image

[copied from codeplex https://nodejstools.codeplex.com/workitem/1877/]

Need guidelines on how to debug fullstack solution

While the documentation and tutorials are great for debugging the server-side node code there is almost no info on how to debug a full stack solution - ie how do we easily switch between debugging node and web browser contexts. Ideally this would be seamless.

You hint at this in a article saying that if client cde is nested in the node directory structure you should change the build action to "content" from compile. That stops client code messing up server debug but how do we debug client side. We could have a separate project but can projects/solutions be nested? Or what is a sensible director structure so that client can be debugged and node can server the code?

In addition, some pointers to info on general web debugging in VS would be useful. Most resources that I can locate assume IIS or .NET solutions or Win.JS in modern App context on client side. What about the simplest case of when we just use HTML5 in a browser of our choice and perhaps JQuery or a framework?

I think VS could be a great tool to rival say WebStorms (VS has better licensing) so this will be required to ease onboarding

copied from: https://nodejstools.codeplex.com/workitem/1909

High cpu/memory [please comment with details]

Multiple people have been running into this issue in varying forms, so this is a catch-all issue we can direct people to until we have narrowed down the root cause (after which we will spawn off a separate issue).

If you're encountering high memory/cpu, please share some details about your project in the comments below to help us get to the bottom of it. In particular...

Please comment with the following details for the quickest response/fix

  • machine specs, vs version, etc. - how high is your memory/cpu usage, and for how long? (seconds? minutes? hours?)
  • have you tried the latest dev build of NTVS?
  • any repro steps, or does it occur seemingly randomly?
  • does this issue occur with a brand new project?
  • does it go away when you disable Node.js IntelliSense? How about ReSharper (if you are using that)? McAfee?
  • If it does not occur with a blank new project, please provide us with your entire project if possible. If you can't provide your entire project, could you please provide us with your package.json, .njsproj file, and your .ntvs_analysis.dat file? (pls make names unique - either attach to this issue, and let us know what the name is, provide a link to a file share, github gist, etc.)
  • Please send us your diagnostic info (Tools > Node.js Tools > Diagnostic Info)
  • please take a screenshot of your task manager details view (sorted by cpu or memory - whichever issue is relevant to you) with the "command line" column included.
  • Any other details you think may be relevant?

Known workarounds

  • Try disabling IntelliSense (Tools -> Options -> Text Editor -> Node.js -> IntelliSense)
  • If IntelliSense is to blame, try disabling IntelliSense for a specific package if you think that may be causing the issue. See Ignoring Directories for Analysis for full details. We recommend ignoring
    • bower_components
    • node_modules\core-js
  • Disable ReSharper (we are working with the ReSharper team to address the memory/perf issues)
  • Disable McAfee on-access scanning for your global npm directory and project directory.
  • Try marking your client-side code files using the "content" build action - see Editing Client Side JavaScript from Node.js for more details

This description will be updated as we learn more information. Resolving this issue is high priority, so thanks in advance for the help!

[copied from https://nodejstools.codeplex.com/workitem/1903]

trailing quote formatted differently on multiple Format calls

EXPECTED:

var x = foo() ' 

ACTUAL:

var x = foo()'

This will alternate between these two formats as you ctrl+k+d

Test Name: TestInvalidTrailingQuote 
Test FullName: AnalysisTests.FormatterTests.TestInvalidTrailingQuote 
Test Source: e:\DevDiv\Offcycle\xTVS\Open_Source\Nodejs_Main\Nodejs\Tests\AnalysisTests\FormatterTests.cs : line 324 
Test Outcome: Failed 
Test Duration: 0:00:00.0109026 

Result Message: Assert.AreEqual failed. Expected:<var x = foo() '>. Actual:<var x = foo()'>. First and Second call to format had different results... 
Result StackTrace: 
at AnalysisTests.FormatterTests.TestCode(String code, String expected, FormattingOptions options) in e:\DevDiv\Offcycle\xTVS\Open_Source\Nodejs_Main\Nodejs\Tests\AnalysisTests\FormatterTests.cs:line 2043 
at AnalysisTests.FormatterTests.TestInvalidTrailingQuote() in e:\DevDiv\Offcycle\xTVS\Open_Source\Nodejs_Main\Nodejs\Tests\AnalysisTests\FormatterTests.cs:line 325

[copied from codeplex https://nodejstools.codeplex.com/workitem/1877]

VS2015 crashes when opening package.json file

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c__DisplayClass2.<ThrowAsync>b__3(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

Formatting mangles multiline / doc comments

And incorrectly indents things that follow them.

Begin with

/*
 * foo
 * bar
 **/
baz

Insert an opening curly brace on a new line before the comment, and a closing one on a new line after the comment. The latter will trigger reformatting, and the result is:

{
    /*
 * foo
 * bar
 **/
baz;
}

Note how only the first line of the comment was indented, but not the following lines; and how baz was not indented, either.

[from codeplex: https://nodejstools.codeplex.com/workitem/1567]

Choose the "main" file defined in package.json as the default startup file

Right now we don't have any logic defined to parse the package.json file (other than for npm packages), so we shouldn't do this feature if we don't also enable executing scripts in package.json, and who knows what else, lest it open us up to an inconsistent experience.

I'm not entirely convinced this feature is worth the effort when you consider the slew of issues it opens us up to (what with invalid package.json files, etc.), but maybe I'm wrong.

Support .editorconfig settings

Using hackfest build.

My .editorconfig settings specified:

Change these settings to your own preference

indent_style = space
indent_size = 2

However, when writing code it used the regular VS defaults (4 spaces).

[from codeplex https://nodejstools.codeplex.com/workitem/1878]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.