Change:
VSCode Version: 1.0 OS Version: OS X 10.11.4 I just upgraded my VSCode to 1.0 release. Since it supports Traditional Chinese now, my default language was set to so that some of comments in the newly config file is in Chinese. As you can see in the following screenshot, a Chinese character "", which is equivalent to the period "." in English, was matched as part of valid URL, and it caused VSCode direct to a incorrect URL. ! I have a working fix for this issue, the naive solution is to check if in is greater than 128, which means a non-ASCII character. Why to match only ASCII character? Because when you copy a URL from most of web browsers to clipboard, it will be automatically converted into ASCII-only string. Also, I came up with another idea to modify the to let it cache all the result of ASCII characters (0~127). In this way, we only need to modify the default case of the switch clause in the state machine. Which solution is more preferable? Please give me some advice then I can submit the patch ASAP.

Discussion:
CannotEndIn = 2 } <del> var getCharacterClasses = (function() { var FORCE_TERMINATION_CHARACTERS = ' t<>'"'; var CANNOT_END_WITH_CHARACTERS = '.,;'; var _cachedResult: CharacterClass[] = null; var findLargestCharCode = (str:string):number => { var r = 0; for (var i = 0, len = str.length; i < len; i++) { r = Math.max(r, str.charCodeAt(i)); </del> <ins> let _openParens = '('.charCodeAt(0); let _closeParens = ')'.charCodeAt(0); let _openSquareBracket = '['.charCodeAt(0); let _closeSquareBracket = ']'.charCodeAt(0); let _openCurlyBracket = '{'.charCodeAt(0); let _closeCurlyBracket = '}'.charCodeAt(0); class CharacterClassifier { /** * Maintain a compact (fully initialized ASCII map for quickly classifying ASCII characters - used more often in code). */ private _asciiMap: CharacterClass[]; /** * The entire map (sparse array). */ private _map: CharacterClass[]; constructor() { var FORCE_TERMINATION_CHARACTERS = ' t<>'"、。｡､，．：；？！＠＃＄％＆＊‘“〈《「『【〔（［｛｢｣｝］）〕】』」》〉”’｀～…'; var CANNOT_END_WITH_CHARACTERS = '.,;'; this._asciiMap = []; for (let i = 0; i < 256; i++) { this._asciiMap[i] = CharacterClass.None; </ins> } <del> return r; }; var set = (str:string, toWhat:CharacterClass): void => { for (var i = 0, len = str.length; i < len; i++) { _cachedResult[str.charCodeAt(i)] = toWhat; </del> <ins> this._map = []; for (let i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) { this._set(FORCE_TERMINATION_CHARACTERS.charCodeAt(i), CharacterClass.ForceTermination); </ins> } <del> }; return function(): CharacterClass[] { if (_cachedResult === null) { // Find cachedResult size var largestCharCode = Math.max( findLargestCharCode(FORCE_TERMINATION_CHARACTERS), findLargestCharCode(CANNOT_END_WITH_CHARACTERS) ); // Initialize cachedResult _cachedResult = []; for (var i = 0; i < largestCharCode; i++) { _cachedResult[i] = CharacterClass.None; } // Fill in cachedResult set(FORCE_TERMINATION_CHARACTERS, CharacterClass.ForceTermination); set(CANNOT_END_WITH_CHARACTERS, CharacterClass.CannotEndIn); </del> <ins> for (let i = 0; i < CANNOT_END_WITH_CHARACTERS.length; i++) { this._set(CANNOT_END_WITH_CHARACTERS.charCodeAt(i), CharacterClass.CannotEndIn); } } private _set(charCode:number, charClass:CharacterClass): void { if (charCode < 256) { this._asciiMap[charCode] = charClass; </ins> } <ins> this._map[charCode] = charClass; } </ins> <del> return _cachedResult; }; })(); </del> <ins> public classify(charCode:number): CharacterClass { if (charCode < 256) { return this._asciiMap[charCode]; } </ins> <del> let _openParens = '('.charCodeAt(0); let _closeParens = ')'.charCodeAt(0); let _openSquareBracket = '['.charCodeAt(0); let _closeSquareBracket = ']'.charCodeAt(0); let _openCurlyBracket = '{'.charCodeAt(0); let _closeCurlyBracket = '}'.charCodeAt(0); </del> <ins> let charClass = this._map[charCode]; if (charClass) { return charClass; } return CharacterClass.None; } } </ins> class LinkComputer {

j:number, lastIncludedCharIndex:number, len:number, <del> characterClasses = getCharacterClasses(), characterClassesLength = characterClasses.length, </del> linkBeginIndex:number, state:number, ch:string,

resetStateMachine:boolean, hasOpenParens:boolean, hasOpenSquareBracket:boolean, <del> hasOpenCurlyBracket:boolean; </del> <ins> hasOpenCurlyBracket:boolean, characterClassifier:CharacterClassifier = new CharacterClassifier(); </ins> for (i = 1, lineCount = model.getLineCount(); i <= lineCount; i++) { line = model.getLineContent(i);

chClass = (hasOpenCurlyBracket ? CharacterClass.None : CharacterClass.ForceTermination); break; default: <del> chClass = (chCode < characterClassesLength ? characterClasses[chCode] : CharacterClass.None); </del> <ins> chClass = characterClassifier.classify(chCode); </ins> } // Check if character terminates link

lastIncludedCharIndex = j - 1; do { chCode = line.charCodeAt(lastIncludedCharIndex); <del> chClass = (chCode < characterClassesLength ? characterClasses[chCode] : CharacterClass.None); </del> <ins> chClass = characterClassifier.classify(chCode); </ins> if (chClass !== CharacterClass.CannotEndIn) { break; }

resetStateMachine = true; } } else if (state === END_STATE) { <del> chClass = (chCode < characterClassesLength ? characterClasses[chCode] : CharacterClass.None); </del> <ins> chClass = characterClassifier.classify(chCode); </ins> // Check if character terminates link if (chClass === CharacterClass.ForceTermination) {

'For instructions, see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx.</value>', '                      http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx         ' ); <ins> assertLink( 'x = "https://en.wikipedia.org/wiki/Zürich";', '     https://en.wikipedia.org/wiki/Zürich  ' ); assertLink( '請參閱 http://go.microsoft.com/fwlink/?LinkId=761051。', '    http://go.microsoft.com/fwlink/?LinkId=761051 ' ); assertLink( '（請參閱 http://go.microsoft.com/fwlink/?LinkId=761051）', '     http://go.microsoft.com/fwlink/?LinkId=761051 ' ); </ins> // foo bar (see http://www.w3schools.com/tags/att_iframe_sandbox.asp) });