Code Monkey home page Code Monkey logo

jstoolnpp's Introduction

A JavaScript (JSON) tool for Notepad++ (formerly JSMinNpp) and Visual Studio Code.

  • Douglas Crockford's JSMin algorithm to minimize JavaScript code.
  • My own algorithm to format JavaScript code.
  • A JSON tree viewer. The JSON tree viewer for Notepad++ can handle >10MB JSON file easily.
  • Support 64bit Notepad++ (from version 1.20.0, ".64.zip" package).

Really helpful to JavaScript coder on Notepad++ and Visual Studio Code. Easy to use it.
Made in China.
Project site: http://www.sunjw.us/jstool

Buy Me a Coffee at ko-fi.com

FEATURES

  • JavaScript minify.
  • JavaScript/JSON format.
  • Sort JSON data alphabetically.
  • JSON tree viewer.

INSTALL (for Notepad++)

Install "JSTool" from Plugin Manager in Notepad++. Or download it from http://sourceforge.net/projects/jsminnpp/ and copy JSMinNpp.dll to plugin directory of Notepad++.

INSTALL (for Visual Studio Code)

Install "JSTool" (sunjw.jstool) from Visual Studio Code Extensions. Or "Download Extension" from https://marketplace.visualstudio.com/items?itemName=sunjw.jstool then using the Install from VSIX... command in the Extensions view command drop-down, or the Extensions: Install from VSIX... command in the Command Palette, point to the .vsix file.

LICENSE

GPL 2.0

AUTHOR

Sun Junwen sunjw8888 at gmail.com

jstoolnpp's People

Contributors

dependabot[bot] avatar nn--- avatar sunjw 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

jstoolnpp's Issues

mulit-line var statements not indented properly

What steps will reproduce the problem?
1. create a var statement spanning multiple lines
2. run JSMin
3. run JSLint

What is the expected output? What do you see instead?
Expected output is that declaired variables on new lines should be indented in 
from the var statement. This is what is expected from JSLint.

Instead, each new variable is at the same column/character position of the var 
statement.

What version of the product are you using? On what operating system?
1.11.0.0 (windows 7 home premium)

Please provide any additional information below.
I don't think there's anything else to add.

Original issue reported on code.google.com by [email protected] on 9 Aug 2012 at 3:09

Sort Alphabetically for JSON

May I suggest having an option to sort the json objects alphabetically? For large json files with many fields, it is always helpful for viewing when they are ordered. Great work on this plugin!

[FeatureRequest] minimize only selected

Hi,
I use your plugin every day, so thank you for your work.

As said in the title I would like very much to have the possibility to call "JSMin" only on the selected text.

I'm using the plugin in another context the it's main/intended purpose ... I'm a Python developer and I use the "ctr+alt+M" to format dictionaries to make them more readable (for who doesn't know, they have the same form as "objects" in Javascript Es. {"a":1} ) when getting them from log &Co.
The "annoyance":
when "debugging"/analyzing ... working from the python shell in general, pasting formatted dicts creates multiple line in the shell history which in turn makes the history navigation and re-execution the "command" difficult, now in order to minimize the dict I have to copy&paste in another tab and the minimize it

"ctrl+alt+shift+M" could be a good shortcut

Thank you

Issue with Notepad++ v7 64 bit

I am using Notepad++ v7 64 bit 21-Sep-2016 build, it shows compatibility error while opening the notepad. Is this because of 64 bit version? I have attached the screenshot of the error.

image

Closing Json Viewer also closes Doc Switcher

What steps will reproduce the problem?

 Firs tensure tab bar is hidden (Preferences->General->Tab bar->Check "Hide")
 1. Go to Settings->Preferences->General and check "Show" on "Document List Panel"
 2. Notice you get a list of open files on the left with title "Doc Switcher"
 3. Select Plugins->JSTool->Json Viewer
 4. Note that the json viewer replaces "Doc Switcher"
 5. Close json viewer via the x button at top right, "Doc Switcher" is hidden.
 6. o to Settings->Preferences->Generalm, notice "Show" on document list panel is still checked.

>What is the expected output? What do you see instead?
Expected:
 When closing json viewer my "Doc Switcher" should remain visible
Actual:
 When closing json viewer the "Doc switcher" unexpectedly also closes.

>What version of the product are you using? On what operating system?
v1.16 Windows 7/Notepad++ v6.4.5

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 4 Feb 2014 at 3:11

JSLint complains a space before ':'

JSLint complains when there is a space in object key/value pairs like -
var Obj = {
key1 : 1,
key2 : 2
};

It will say "Unexpected space between 'key1' and ':'.

Incorrect indents?

Hi!
It seems there is a problem with the indentation
1.

var a = 0,
b = 1;

should be

var a = 0,
    b = 1;
a += v1 + v2 +... +
v7 + v8

should be

a += v1 + v2 +... +
     v7 + v8
$Window.off('click')
 ? true
 : false;

should be

$Window.off('click')
    ? true
    : false;
$Pic.removeAttr('src')
.removeProp('title')
.hide();

should be

$Pic.removeAttr('src')
    .removeProp('title')
    .hide();
switch (foo) {
case 1:
    bar = 1;
    break;
default:
    bar = 2;
}

should be

switch (foo) {
    case 1:
        bar = 1;
        break;
    default:
        bar = 2;
}

Put releases on GitHub

Your site lacks https, which means that anyone can inject malicious code into the binaries. So I suggest you to put releases on GitHub and sign every with gpg

Suggestion: improved handling/preview of newline in strings

Hi
I have a suggestion for improvement in the JSON Viewer
If I have strings with encoded newlines \r\n as in the image below
image
it is cumbersome to read the content.
Would it be possible to have a "preview" or something on string values that opens a decoded version of the string in a multi line textbox?
That way you would be able to read strings better and copy'n paste the content to another document.

Formatting lambda wrong

When you call the formatter on a lambda expression
(var) => {}
two spaces get inserted between the equal and the greater than sign, breaking the syntax.
(var) = > {}
I suspect it gets recognized as an assignment.

it won't collapse json array

I don't find ways to open array ,cause the array is so long ,I want to make it more readable ,but is just in one line.

Compact mode

Hi
I made this "compact mode" for myself.
I share it with you, in case you want to include it in your branch.
I didn't test it with comments, arrays, nor exotics things.
The two parameters doesn't have their gui yet (don't understand how to modify it, and didn't have the time to learn it).

Thank you for this awesome plugin!
Merill

From b57b944a2c343b4497e5521251f2c8ddca314f78 Mon Sep 17 00:00:00 2001
From: merill <[email protected]>
Date: Wed, 15 Feb 2017 14:23:27 +0100
Subject: [PATCH] compact mode todo: bind the parameters into the gui

---
 trunk/src/jsparser.cpp        | 62 +++++++++++++++++++++++++++++++++---
 trunk/src/jsparser.h          |  4 ++-
 trunk/src/realjsformatter.cpp | 73 ++++++++++++++++++++++++++++++++++++++-----
 trunk/src/realjsformatter.h   |  9 ++++++
 4 files changed, 136 insertions(+), 12 deletions(-)

diff --git a/trunk/src/jsparser.cpp b/trunk/src/jsparser.cpp
index 24eb76d..c3682c4 100644
--- a/trunk/src/jsparser.cpp
+++ b/trunk/src/jsparser.cpp
@@ -393,12 +393,66 @@ bool JSParser::GetToken()
 	{
 		// 有排队的换行
 		m_tokenB = m_tokenBQueue.front();
-		m_tokenBQueue.pop();
+		m_tokenBQueue.pop_front();
 	}
 
 	return (m_charA != 0 || m_tokenA.code != "");
 }
 
+int JSParser::HasAfter(char* code2Find, char* codeToAvoid, int maxTokens, int maxChars)
+{
+	TokenQueue temptokenBQueue = m_tokenBQueue;
+	TokenQueue alltokenBQueue;
+	Token m_tokenB_save = m_tokenB;
+	int findPos = -1;
+	int pos = 0;
+	int posChar = 0;
+	if (m_tokenB.code == code2Find && findPos<0) return 0;
+	if (m_tokenB.code == codeToAvoid && findPos<0) return 6666;
+	pos++;
+	posChar += m_tokenB.code.length();
+	//alltokenBQueue.push_back(m_tokenB);
+	for (int i = 0; i < m_tokenBQueue.size(); i++){
+		alltokenBQueue.push_back(m_tokenBQueue[i]);
+		if (alltokenBQueue[i].code == code2Find && findPos<0 && posChar<maxChars) findPos = pos;
+		if (alltokenBQueue[i].code == codeToAvoid && findPos<0) findPos = 7777;
+		pos++;
+		posChar += m_tokenBQueue[i].code.length();
+	}
+	while (alltokenBQueue.size() < maxTokens && findPos<0 && posChar<maxChars){
+		m_tokenBQueue = TokenQueue();
+		GetTokenRaw();
+		PrepareTokenB(); // 看看是不是要跳过换行
+		if (m_tokenB.code == code2Find && findPos<0) findPos = pos;
+		if (m_tokenB.code == codeToAvoid && findPos<0) findPos = 8888;
+		pos++;
+		posChar += m_tokenB.code.length();
+		alltokenBQueue.push_back(m_tokenB);
+		for (int i = 0; i < m_tokenBQueue.size(); i++){
+			alltokenBQueue.push_back(m_tokenBQueue[i]);
+			if (alltokenBQueue[i].code == code2Find && findPos<0 && posChar<maxChars) findPos = pos;
+			if (alltokenBQueue[i].code == codeToAvoid && findPos<0) findPos = 8888;
+			pos++;
+			posChar += m_tokenBQueue[i].code.length();
+		}
+	}
+
+	/*for (int i = 0; i < alltokenBQueue.size(); i++){
+		if (alltokenBQueue[i].code == "{"){
+			return i;
+		}
+	}*/
+
+	m_tokenBQueue = alltokenBQueue;
+	//m_tokenB = alltokenBQueue.front();
+	//alltokenBQueue.pop_front();
+	m_tokenB = m_tokenB_save;
+
+	if (findPos >= 0) return findPos;
+
+	return 9999;
+}
+
 void JSParser::PrepareRegular()
 {
 	/*
@@ -486,12 +540,12 @@ void JSParser::PrepareTokenB()
 		{
 			temp.code = string("\n");
 			temp.type = OPER_TYPE;
-			m_tokenBQueue.push(temp);
+			m_tokenBQueue.push_back(temp);
 		}
 		temp = m_tokenB;
-		m_tokenBQueue.push(temp);
+		m_tokenBQueue.push_back(temp);
 		temp = m_tokenBQueue.front();
-		m_tokenBQueue.pop();
+		m_tokenBQueue.pop_front();
 		m_tokenB = temp;
 	}
 }
diff --git a/trunk/src/jsparser.h b/trunk/src/jsparser.h
index 64708ca..d09edfd 100644
--- a/trunk/src/jsparser.h
+++ b/trunk/src/jsparser.h
@@ -95,7 +95,7 @@ public:
 	typedef stack<char> CharStack;
 	typedef stack<bool> BoolStack;
 	typedef stack<int> IntStack;
-	typedef queue<Token> TokenQueue;
+	typedef deque<Token> TokenQueue;
 	typedef map<string, char> StrCharMap;
 	typedef set<string> StrSet;
 
@@ -158,6 +158,8 @@ protected:
 
 	bool GetToken(); // 处理过负数, 正则等等的 GetToken 函数
 
+	int HasAfter(char* code2Find, char* codeToAvoid, int maxTokens, int maxChars);
+
 	void inline StartParse()
 	{ m_startClock = clock(); }
 
diff --git a/trunk/src/realjsformatter.cpp b/trunk/src/realjsformatter.cpp
index 9611b60..1cb59f6 100644
--- a/trunk/src/realjsformatter.cpp
+++ b/trunk/src/realjsformatter.cpp
@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 #include <string>
 #include <cstring>
 #include <iostream>
+#include <sstream>
 #include <ctime>
 
 #include "realjsformatter.h"
@@ -179,6 +180,9 @@ void RealJSFormatter::PutToken(const Token& token,
 		PutChar(token[i]);
 	PutChar('\n');*/
 	// debug
+	m_nbCharThisLine += leftStyle.length();
+	m_nbCharThisLine += token.code.length();
+	m_nbCharThisLine += rightStyle.length();
 	PutString(leftStyle);
 	PutString(token);
 	PutString(rightStyle);
@@ -343,6 +347,7 @@ void RealJSFormatter::Go()
 	bool bHaveNewLine;
 	char tokenAFirst;
 	char tokenBFirst;
+	m_tokenZ.code = ";";
 
 	StartParse();
 
@@ -420,6 +425,7 @@ void RealJSFormatter::Go()
 			ProcessString(bHaveNewLine, tokenAFirst, tokenBFirst);
 			break;
 		}
+		m_tokenZ = m_tokenA;
 	}
 
 	if(!m_bLineTemplate)
@@ -553,8 +559,12 @@ void RealJSFormatter::ProcessOper(bool bHaveNewLine, char tokenAFirst, char toke
 		// 对于 do{} 也一样
 
 		GetStackTop(m_blockStack, topStack);
-		if(topStack != JS_BRACKET && !bHaveNewLine && !IsInlineComment(m_tokenB))
+		if (topStack != JS_BRACKET && !bHaveNewLine && !IsInlineComment(m_tokenB))
+		{
 			PutToken(m_tokenA, string(""), strRight.append("\n")); // 如果不是 () 里的 ; 就换行
+			m_lineHasB = false;
+			m_nbCharThisLine = 0;
+		}
 		else if(topStack == JS_BRACKET || m_tokenB.type == COMMENT_TYPE_1 ||
 			IsInlineComment(m_tokenB))
 			PutToken(m_tokenA, string(""), strRight); // (; ) 空格
@@ -571,8 +581,28 @@ void RealJSFormatter::ProcessOper(bool bHaveNewLine, char tokenAFirst, char toke
 			--m_nIndents;
 			m_blockStack.pop();
 		}
-		if(StackTopEq(m_blockStack, JS_BLOCK) && !bHaveNewLine)
-			PutToken(m_tokenA, string(""), strRight.append("\n")); // 如果是 {} 里的
+
+		if (m_compactMode && m_tokenZ.code == "}")
+		{
+			//compact mode only: },"bla" => },\n"bla"
+			PutToken(m_tokenA, string(""), strRight.append("\n"));
+			m_lineHasB = false;
+			m_nbCharThisLine = 0;
+		}
+		else if(StackTopEq(m_blockStack, JS_BLOCK) && !bHaveNewLine)
+			{
+				int ba = HasAfter("{","}",6, 99999);
+				if (m_compactMode && ((/*m_lineHasB &&*/ ba<6) || m_nbCharThisLine>m_maxCharsPerLine))
+				{
+					//compact mode only: , "bla":{...{ => ,\n "bla":{
+					PutToken(m_tokenA, string(""), strRight.append("\n"));
+					m_lineHasB = false;
+					m_nbCharThisLine = 0;
+				}
+				else
+					//default path (\n after each ',' or compact mode: no \n after ',' unless special case.
+					PutToken(m_tokenA, string(""), strRight.append(m_compactMode?"":"\n")); // 如果是 {} 里的
+			}
 		else
 			PutToken(m_tokenA, string(""), strRight);
 
@@ -581,6 +611,7 @@ void RealJSFormatter::ProcessOper(bool bHaveNewLine, char tokenAFirst, char toke
 
 	if(m_tokenA.code == "{")
 	{
+		m_lineHasB = true;
 		GetStackTop(m_blockStack, topStack);
 		if(topStack == JS_IF || topStack == JS_FOR ||
 			topStack == JS_WHILE || topStack == JS_DO ||
@@ -647,8 +678,22 @@ void RealJSFormatter::ProcessOper(bool bHaveNewLine, char tokenAFirst, char toke
 		else
 		{
 			string strLeft = (m_struOption.eBracNL == NEWLINE_BRAC && !m_bNewLine) ? string("\n") : string("");
-			if(!bHaveNewLine && !IsInlineComment(m_tokenB)) // 需要换行
-				PutToken(m_tokenA, strLeft, strRight.append("\n"));
+			if (!bHaveNewLine && !IsInlineComment(m_tokenB)) // 需要换行
+			{
+				int ba = 9999;
+				if (m_compactMode) ba = HasAfter("}", "{", 40, m_maxCharsPerLine);
+				if (ba<40)
+					// compact mode only: "bla":{"length":"short"}  ok, no '\n' before }
+					PutToken(m_tokenA, strLeft, strRight);
+				else
+				{
+					// compact mode: "bla":{...(very long) => "bla":{\n...(very long)
+					// or default path
+					PutToken(m_tokenA, strLeft, strRight.append("\n"));
+					m_lineHasB = false;
+					m_nbCharThisLine = 0;
+				}
+			}
 			else
 				PutToken(m_tokenA, strLeft, strRight);
 		}
@@ -718,13 +763,27 @@ void RealJSFormatter::ProcessOper(bool bHaveNewLine, char tokenAFirst, char toke
 			}
 		}
 
+
+		// compact_mode: "bla":{"a":1}  ok, no '\n' before }
+		if (m_lineHasB && m_compactMode){
+			PutToken(m_tokenA,string(""),string(""));
+			m_lineHasB = false;
+			return; // }
+		}
+
 		string leftStyle("");
-		if(!m_bNewLine)
+		if (!m_bNewLine)
+		{
 			leftStyle = "\n";
-		if(m_bEmptyBracket)
+			m_lineHasB = false;
+			m_nbCharThisLine = 0;
+		}
+		if (m_bEmptyBracket)
 		{
 			leftStyle = "";
 			strRight.append("\n");
+			m_lineHasB = false;
+			m_nbCharThisLine = 0;
 			m_bEmptyBracket = false;
 		}
 
diff --git a/trunk/src/realjsformatter.h b/trunk/src/realjsformatter.h
index dac83c3..c21de3d 100644
--- a/trunk/src/realjsformatter.h
+++ b/trunk/src/realjsformatter.h
@@ -105,6 +105,15 @@ private:
 	// 以下为配置项
 	FormatterOption m_struOption;
 
+	//vars used by compact mode
+	Token m_tokenZ;
+	bool m_lineHasB = false;
+	int m_nbCharThisLine = 0;
+
+	//parameters for compact mode TODO: add them to the ui
+	bool m_compactMode = true;
+	int m_maxCharsPerLine = 180;
+
 private:
 	// 阻止拷贝
 	RealJSFormatter(const RealJSFormatter&);
-- 
2.5.0.windows.1


Warnings

Pay attention to these warnings, they can cause crashes.
size_t , LRESULT are 64-bit.

1>..\..\trunk\src\realjsformatter.cpp(155): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data

1>..\..\trunk\src\realjsformatter.cpp(806): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data

2>src\jsMinNpp.cpp(306): warning C4244: '=': conversion from 'LRESULT' to 'char', possible loss of data
2>src\jsMinNpp.cpp(315): warning C4244: '=': conversion from 'LRESULT' to 'char', possible loss of data
2>src\jsMinNpp.cpp(370): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data

2>src\JSONDialog.cpp(256): warning C4244: '=': conversion from 'LRESULT' to 'int', possible loss of data
2>src\JSONDialog.cpp(262): warning C4244: 'initializing': conversion from 'LRESULT' to 'int', possible loss of data
2>src\JSONDialog.cpp(332): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data

2>src\realjsformatter.cpp(155): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
2>src\realjsformatter.cpp(806): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data

And in warning level 4 there are some uninitialized variables:

3>trunk\src\jsparser.cpp(206): warning C4701: potentially uninitialized local variable 'chQuote' used
4>src\JSFormatterConsole.cpp(35): warning C4244: 'return': conversion from 'int' to 'char', possible loss of data
3>runk\src\jsparser.cpp(236): warning C4701: potentially uninitialized local variable 'chComment' used
4>  Generating code
3>runk\src\jsonparser.cpp(99): warning C4701: potentially uninitialized local variable 'keyLine' used

[Feature Request] Need options to delete,copy a node in Json Viewer Tree

The following are the feature requests i want in this ?
1. Right Click on Node in Treeview in Menu -> Copy Node  (copy node with value )
2. Right Click on Node in Treeview in Menu -> Copy Node Value ( copy just value 
of the given node )
3. Right Click on Node in Treeview in Menu -> Delete Node ( Deletes the current 
node ).
4. Right Click on Node in Treeview in Menu -> Expand All / Collapse All of node 


What version of the product are you using? On what operating system?
 1.16.0.0 , Notepad ++ (5.9.6.2 Unicode ) , Win 7 32 bit

Please provide any additional information below.

You can say that click on node and copy/ delete in the text view only but if 
node is big then its little difficult to copy node / delete . It will be very 
helpful , if this feature is done.


Original issue reported on code.google.com by [email protected] on 24 Nov 2013 at 7:35

Nested function

SDK.JQuery.createRecord(
   NASF,
   "amdx_accountsetup",
   function (NASF) {
   Xrm.Utility.openEntityForm("amdx_accountsetup", NASF.amdx_accountsetupId);
},
   errorHandler);

Inline comment

function test() {
    return /*test*/10000;
}

function test2() {
    return 100+/*test*/10000;
}

function test3() {
    return /*test*/10000+100;
}

function test4() {
    return 10000/*test*/+100;
}

[Feature Request] Make update check at startup optional

Hi,

could you please make the update check at startup optional or remove it completely?

Every time Notepad++ is started, it tries to connect to the internet. We identified JSTool as reason and therefore removed this plugin from our distribution package.
In our company, we have a strict policy regarding used software. Employees are not allowed to install any software (or even newer versions) on their own and all software needs to be tested and distributed by our IT department. Therefore, we disable all auto update functions to minimize support requests.

Maybe this feature is a useful thing for home users, but as Notepad++ has its own plugin manager, it also shouldn't be needed for home users.

We'd really be pleased to add JSTool again to our package.

Validation of json content

Is it possible to add a validation menu option for the plugin. On clicking on the validation it should show whether the content is the text document is a valid json or not.

For ex., for below Json:
{
"test": "123"
}

the validation result should be "Valid Json"

For below Json:
{
"test": "124
}

the validation result should be "Invalid Json, at line 2 (missing quote)"

Navigate with JSon Viewer

To find a specific value in a JSon-File the JSon-View panel is helpful.
However, there's one important thing missing:
If you doubleclick a value Notepad++ should jump to the position (at least the 
line) where the JSon-Value is located.

(JSMin 1.11.2, Notepad++ 6.1.8, WinXP)

Thanks!

Original issue reported on code.google.com by [email protected] on 18 Sep 2012 at 10:56

JSLint issue

This is how JSFormat would output this code -

(function () {
    "use strict";
    var func = window.callback(true, function () {
            return 0;
        });
    var expr = window.aa < window.bb ? func : false;
    if (expr) {
        return true;
    }
}
    ());

This is what JSLint considers the 'correct' format -

(function () {
    "use strict";
    var func = window.callback(true, function () {
        return 0;
    });
    var expr = window.aa < window.bb
        ? func
        : false;
    if (expr) {
        return true;
    }
}());

[Feature Request] Single property objects on one line

Would love to have an option to keep short properties (like ones that contain a single object or value) on a single line to improve readability. For example:

"Foo" : { "Bar" : {"Array" : [{"Name" : "Value" }] } }

Should be displayed as above, instead of:

"Foo" : {
    "Bar" : {
        "Array" : [{
                    "Name" : "Value"
            }
        ]
    }
}

regex expression Incoming parameters mangled with JSFormat

What steps will reproduce the problem?

JSFormat the following:
var g = /<img\s[\S]*\salt=[\]["][^-]*[-]?([\S]*)[\]["]\s?[\][/]>/ig;

What is the expected output? What do you see instead?

expected:
var g = /<img\s[\S]*\salt=[\]["][^-]*[-]?([\S]*)[\]["]\s?[\][/]>/ig;

seen
var g = /<img\s[\S]*\salt=[\]["][^-]*[-]?([\S]*)[\]["]\s?[\][/] >  / ig;

What version of the product are you using? On what operating system?

Version 1.16.5.0

Please provide any additional information below.

Likeness issues 6,Hope for an early fix.

Original issue reported on code.google.com by [email protected] on 17 Jul 2014 at 9:57

Ctrl + Alt + M has stopped working

The hot key Ctrl + Alt + M for JSFormat has stopped working after the last update of notepad++
JSFormat from the plugin's menu works ok.
npp 7.5.1
jstool 1.21.0.0

Can not save options

Clean download of Notepad++ minimalist package 32-bit x86, v7.3.3
Download JSMinNPP.dll - Unicode 32bit build - JSToolNPP.1.20.2.uni.32.zip
Put in plugins folder.

Plugin appears and works, but options are not saved when clicking "OK". So it only works with default options.

JSFormat causes cursor to jump

What steps will reproduce the problem?
1. Open some un-formatted JS file.
2. Apply jstool's JSFormat option.

What is the expected output? What do you see instead?

I expect the cursor to stay at the current line.
Instead it jumps to some other place in the text.

This is pretty annoying, especially when using the shortcut while working on 
some text.


What version of the product are you using? On what operating system?

jstool: 1.16.5.0
notepad++: 6.5.5




Original issue reported on code.google.com by [email protected] on 15 Jul 2014 at 9:25

JSFormat messes Bookmarks

When using JSFormat on a selection that contains a npp bookmark, the bookmark is moved to the last selected line.
When using JSFormat without any selected text, the bookmarks are removed.

I believe the desired function would be to preserve the bookmarks at their original line, even if the line is split during the formatting.

Issue with JSFormat for return statement

What steps will reproduce the problem?
1. open a javascript file that has some `return SMTHG` statements
2. execute JSMin->JSFormat

What is the expected output? What do you see instead?

I expect a nicely formatted and working code - I get a nicely formatted but not 
working code :)

eg.

-----
function a() { return {a:'a'}}
-----

becomes:

-----
function a()
{
    return
    {
        a : 'a'
    }
}
-----

it should be:

-----
function a()
{
    return {
        a : 'a'
    }
}
-----

(actually I personally prefer 

-----
function  a() {
    /* blah blah */
}
-----


What version of the product are you using? On what operating system?

1.11


Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 22 Jun 2012 at 11:04

Not able to comment code

After using jstool to format a javascript file, it disables the ability to comment code from shortcuts. Every time I apply the format, I have to reopen the file to be able to comment code. The commenting function is working on other languages.

Notepad++ 7.5.1
JSTool 1.21

whitespace between string and colon

For formatting JSon-files we follow the examples from json.org.
If you look at
http://json.org/example.html
you'll see there's no whitespace between the string and the colon.

So it's 
{"item": "value"
}

and not

{"item" : "value"
}

Any chance this will be configurable in JSMin formatter?

(JSMin 1.11.2, Notepad++ 6.1.8, WinXP)

Thanks!

Original issue reported on code.google.com by [email protected] on 18 Sep 2012 at 10:54

no semicolon variable declaration with assignment

I noticed that if you dont use semiclons a new indent gets added after a variable declaration with assignment, but only for the first declaration in a block. I don't even know if you support no semicolon sintax but since it almost works it would be nice to have it.

if (index = 0) {
    var a
    var test = 4
        test = index + test
        var test1 = 0
        test1 = test - index
        if (a < b) {
            console.log(c)
            var target,
            test1 = 7
                c++
                var d = 1
                target = a - b
        }
}

(dont mind the code it's total gibberish for indent testing purposes)

regex expression mangled with JSFormat

What steps will reproduce the problem?
1. JSFormat the following:
var n = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//; 


What is the expected output? What do you see instead?

expected:
var n = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//; 

seen:
var n = /\/\*[^*]*\*+([^/ * ][^ * ] *  \  *  + ) *  \ //;


What version of the product are you using? On what operating system?
1.16.0.0 unicode
windows vista sp2

Original issue reported on code.google.com by [email protected] on 21 Oct 2013 at 12:44

UTF8 display problems in the JSON View

What steps will reproduce the problem?
1. Just use any non english character with unicode format in a JSON file
2.
3.

What is the expected output? What do you see instead?

Bad characters instead of the correct hungarian ones.

try this minimal json:
{"Text" : "Sűrű szövésű női pulóver"}


What version of the product are you using? On what operating system?
Windows 7, JSMin 1.13.0.0

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 20 Jun 2013 at 5:55

VS2017

What about using VS2017 compiler ?

New line after object ending comma

Would be nice to have a setting for place object beginning bracket in a new line.
So instead of this:
{
"fieldName": "One"
}, {
"fieldName": "Two"
}
We would have this:
{
"fieldName": "One"
},
{
"fieldName": "Two"
}

[Feature Request] Extended option for added new line and added spaces

Can we get an option to no added new line after '}' in case of '})' ?

Ex:

(function (data)
{
...
})

Can we get an option to no added new line after if or for when used only one operation?

Ex:

if ( a > b ) return;

It would be really nice to have something for adding spaces into the conditions brackets .

Ex:

if ( a > b ) 
{
...
}

for ( var i = 0; i < 10; i++ ) 
{
...
}

JavaScript formatting function freezes up Notepad++ UI

Running the latest Notepad++ with latest JSMinNPP.dll on Windows 7 x64 in VMWare VM on OSX:

Occasionally the JS formatting feature works, usually it just makes the Notepad++ UI freeze up (completely unresponsive) until the application is terminated from Task Manager.

The files being formatted are located in a shared folder on the filesystem of the OS X host.

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.