vscode-html-languageservice
Advanced tools
Comparing version 1.0.0-next.3 to 1.0.0-next.4
@@ -206,2 +206,13 @@ (function (factory) { | ||
var offset = stream.pos(); | ||
var oldState = state; | ||
var token = internalScan(); | ||
if (token !== TokenType.EOS && offset === stream.pos()) { | ||
console.log('Scanner.scan has not advanced at offset ' + offset + ', state before: ' + oldState + ' after: ' + state); | ||
stream.advance(1); | ||
return finishToken(offset, TokenType.Unknown); | ||
} | ||
return token; | ||
} | ||
function internalScan() { | ||
var offset = stream.pos(); | ||
if (stream.eos()) { | ||
@@ -256,5 +267,8 @@ return finishToken(offset, TokenType.EOS); | ||
} | ||
state = ScannerState.WithinEndTag; | ||
stream.advanceUntilChar(_RAN); | ||
state = ScannerState.WithinEndTag; | ||
return finishToken(offset, TokenType.Unknown, localize('error.endTagNameExpected', 'End tag name expected.')); | ||
if (offset < stream.pos()) { | ||
return finishToken(offset, TokenType.Unknown, localize('error.endTagNameExpected', 'End tag name expected.')); | ||
} | ||
return internalScan(); | ||
case ScannerState.WithinEndTag: | ||
@@ -282,5 +296,8 @@ if (stream.skipWhitespace()) { | ||
} | ||
state = ScannerState.WithinTag; | ||
stream.advanceUntilChar(_RAN); | ||
state = ScannerState.WithinTag; | ||
return finishToken(offset, TokenType.Unknown, localize('error.startTagNameExpected', 'Start tag name expected.')); | ||
if (offset < stream.pos()) { | ||
return finishToken(offset, TokenType.Unknown, localize('error.startTagNameExpected', 'Start tag name expected.')); | ||
} | ||
return internalScan(); | ||
case ScannerState.WithinTag: | ||
@@ -333,3 +350,3 @@ if (stream.skipWhitespace()) { | ||
state = ScannerState.WithinTag; | ||
return scan(); // no advance yet - jump to WithinTag | ||
return internalScan(); // no advance yet - jump to WithinTag | ||
case ScannerState.BeforeAttributeValue: | ||
@@ -363,3 +380,3 @@ if (stream.skipWhitespace()) { | ||
hasSpaceAfterTag = false; | ||
return scan(); // no advance yet - jump to WithinTag | ||
return internalScan(); // no advance yet - jump to WithinTag | ||
case ScannerState.WithinScriptContent: | ||
@@ -401,3 +418,3 @@ // see http://stackoverflow.com/questions/14574471/how-do-browsers-parse-a-script-tag-exactly | ||
} | ||
return scan(); // no advance yet - jump to content | ||
return internalScan(); // no advance yet - jump to content | ||
case ScannerState.WithinScriptContent: | ||
@@ -409,3 +426,3 @@ stream.advanceUntilRegExp(/<\/style/i); | ||
} | ||
return scan(); // no advance yet - jump to content | ||
return internalScan(); // no advance yet - jump to content | ||
} | ||
@@ -412,0 +429,0 @@ stream.advance(1); |
@@ -6,3 +6,3 @@ (function (factory) { | ||
else if (typeof define === 'function' && define.amd) { | ||
define(["require", "exports", '../beautify/beautify-html'], factory); | ||
define(["require", "exports", 'vscode-languageserver-types', '../beautify/beautify-html'], factory); | ||
} | ||
@@ -15,2 +15,3 @@ })(function (require, exports) { | ||
'use strict'; | ||
var vscode_languageserver_types_1 = require('vscode-languageserver-types'); | ||
var beautify_html_1 = require('../beautify/beautify-html'); | ||
@@ -24,2 +25,5 @@ function format(document, range, options) { | ||
} | ||
else { | ||
range = vscode_languageserver_types_1.Range.create(vscode_languageserver_types_1.Position.create(0, 0), document.positionAt(value.length)); | ||
} | ||
var htmlOptions = { | ||
@@ -26,0 +30,0 @@ indent_size: options.insertSpaces ? options.tabSize : 1, |
{ | ||
"name": "vscode-html-languageservice", | ||
"version": "1.0.0-next.3", | ||
"version": "1.0.0-next.4", | ||
"description": "Language service for HTML", | ||
@@ -5,0 +5,0 @@ "main": "./lib/htmlLanguageService.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280058
4562