UNPKG

code-server

Version:

Run VS Code on a remote server.

6 lines (4 loc) • 16.1 kB
/*!-------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/(function(){var T=["require","exports","vs/base/common/platform","vs/base/common/extpath","vs/base/common/strings","vs/base/common/network","vs/base/common/uri","vs/base/common/decorators","vs/base/common/path","vs/base/common/resources","vs/base/common/types","vs/workbench/contrib/output/common/outputLinkComputer","vs/editor/common/core/range"],$=function(O){for(var e=[],f=0,g=O.length;f<g;f++)e[f]=T[O[f]];return e};define(T[7],$([0,1]),function(O,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throttle=e.debounce=e.memoize=e.createDecorator=void 0;function f(A){return(P,r,a)=>{let c=null,h=null;if(typeof a.value=="function"?(c="value",h=a.value):typeof a.get=="function"&&(c="get",h=a.get),!h)throw new Error("not supported");a[c]=A(h,r)}}e.createDecorator=f;function g(A,P,r){let a=null,c=null;if(typeof r.value=="function"?(a="value",c=r.value,c.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(a="get",c=r.get),!c)throw new Error("not supported");const h=`$memoize$${P}`;r[a]=function(...u){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:c.apply(this,u)}),this[h]}}e.memoize=g;function m(A,P,r){return f((a,c)=>{const h=`$debounce$${c}`,u=`$debounce$result$${c}`;return function(...l){this[u]||(this[u]=r?r():void 0),clearTimeout(this[h]),P&&(this[u]=P(this[u],...l),l=[this[u]]),this[h]=setTimeout(()=>{a.apply(this,l),this[u]=r?r():void 0},A)}})}e.debounce=m;function d(A,P,r){return f((a,c)=>{const h=`$throttle$timer$${c}`,u=`$throttle$result$${c}`,l=`$throttle$lastRun$${c}`,t=`$throttle$pending$${c}`;return function(...i){if(this[u]||(this[u]=r?r():void 0),(this[l]===null||this[l]===void 0)&&(this[l]=-Number.MAX_VALUE),P&&(this[u]=P(this[u],...i)),this[t])return;const o=this[l]+A;o<=Date.now()?(this[l]=Date.now(),a.apply(this,[this[u]]),this[u]=r?r():void 0):(this[t]=!0,this[h]=setTimeout(()=>{this[t]=!1,this[l]=Date.now(),a.apply(this,[this[u]]),this[u]=r?r():void 0},o-Date.now()))}})}e.throttle=d}),define(T[3],$([0,1,8,2,4,10]),function(O,e,f,g,m,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parseLineAndColumnAware=e.indexOfPath=e.getDriveLetter=e.hasDriveLetter=e.isRootOrDriveLetter=e.sanitizeFilePath=e.isWindowsDriveLetter=e.isEqualOrParent=e.isEqual=e.isValidBasename=e.isUNC=e.getRoot=e.toPosixPath=e.toSlashes=e.isPathSeparator=void 0;function A(n){return n===47||n===92}e.isPathSeparator=A;function P(n){return n.replace(/[\\/]/g,f.posix.sep)}e.toSlashes=P;function r(n){return n.indexOf("/")===-1&&(n=P(n)),/^[a-zA-Z]:(\/|$)/.test(n)&&(n="/"+n),n}e.toPosixPath=r;function a(n,s=f.posix.sep){if(!n)return"";const R=n.length,y=n.charCodeAt(0);if(A(y)){if(A(n.charCodeAt(1))&&!A(n.charCodeAt(2))){let U=3;const D=U;for(;U<R&&!A(n.charCodeAt(U));U++);if(D!==U&&!A(n.charCodeAt(U+1))){for(U+=1;U<R;U++)if(A(n.charCodeAt(U)))return n.slice(0,U+1).replace(/[\\/]/g,s)}}return s}else if(v(y)&&n.charCodeAt(1)===58)return A(n.charCodeAt(2))?n.slice(0,2)+s:n.slice(0,2);let E=n.indexOf("://");if(E!==-1){for(E+=3;E<R;E++)if(A(n.charCodeAt(E)))return n.slice(0,E+1)}return""}e.getRoot=a;function c(n){if(!g.isWindows||!n||n.length<5)return!1;let s=n.charCodeAt(0);if(s!==92||(s=n.charCodeAt(1),s!==92))return!1;let R=2;const y=R;for(;R<n.length&&(s=n.charCodeAt(R),s!==92);R++);return!(y===R||(s=n.charCodeAt(R+1),isNaN(s)||s===92))}e.isUNC=c;const h=/[\\/:\*\?"<>\|]/g,u=/[\\/]/g,l=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function t(n,s=g.isWindows){const R=s?h:u;return!(!n||n.length===0||/^\s+$/.test(n)||(R.lastIndex=0,R.test(n))||s&&l.test(n)||n==="."||n===".."||s&&n[n.length-1]==="."||s&&n.length!==n.trim().length||n.length>255)}e.isValidBasename=t;function i(n,s,R){const y=n===s;return!R||y?y:!n||!s?!1:(0,m.equalsIgnoreCase)(n,s)}e.isEqual=i;function o(n,s,R,y=f.sep){if(n===s)return!0;if(!n||!s||s.length>n.length)return!1;if(R){if(!(0,m.startsWithIgnoreCase)(n,s))return!1;if(s.length===n.length)return!0;let U=s.length;return s.charAt(s.length-1)===y&&U--,n.charAt(U)===y}return s.charAt(s.length-1)!==y&&(s+=y),n.indexOf(s)===0}e.isEqualOrParent=o;function v(n){return n>=65&&n<=90||n>=97&&n<=122}e.isWindowsDriveLetter=v;function b(n,s){return g.isWindows&&n.endsWith(":")&&(n+=f.sep),(0,f.isAbsolute)(n)||(n=(0,f.join)(s,n)),n=(0,f.normalize)(n),g.isWindows?(n=(0,m.rtrim)(n,f.sep),n.endsWith(":")&&(n+=f.sep)):(n=(0,m.rtrim)(n,f.sep),n||(n=f.sep)),n}e.sanitizeFilePath=b;function w(n){const s=(0,f.normalize)(n);return g.isWindows?n.length>3?!1:C(s)&&(n.length===2||s.charCodeAt(2)===92):s===f.posix.sep}e.isRootOrDriveLetter=w;function C(n,s){return(s!==void 0?s:g.isWindows)?v(n.charCodeAt(0))&&n.charCodeAt(1)===58:!1}e.hasDriveLetter=C;function L(n){return C(n)?n[0]:void 0}e.getDriveLetter=L;function I(n,s,R){return s.length>n.length?-1:n===s?0:(R&&(n=n.toLowerCase(),s=s.toLowerCase()),n.indexOf(s))}e.indexOfPath=I;function q(n){const s=n.split(":");let R,y,E;if(s.forEach(U=>{const D=Number(U);(0,d.isNumber)(D)?y===void 0?y=D:E===void 0&&(E=D):R=R?[R,U].join(":"):U}),!R)throw new Error("Format for `--goto` should be: `FILE:LINE(:COLUMN)`");return{path:R,line:y!==void 0?y:void 0,column:E!==void 0?E:y!==void 0?1:void 0}}e.parseLineAndColumnAware=q});var M=this&&this.__decorate||function(O,e,f,g){var m=arguments.length,d=m<3?e:g===null?g=Object.getOwnPropertyDescriptor(e,f):g,A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(O,e,f,g);else for(var P=O.length-1;P>=0;P--)(A=O[P])&&(d=(m<3?A(d):m>3?A(e,f,d):A(e,f))||d);return m>3&&d&&Object.defineProperty(e,f,d),d};define(T[5],$([0,1,7,2,6]),function(O,e,f,g,m){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FileAccess=e.RemoteAuthorities=e.Schemas=void 0;var d;(function(r){r.inMemory="inmemory",r.vscode="vscode",r.internal="private",r.walkThrough="walkThrough",r.walkThroughSnippet="walkThroughSnippet",r.http="http",r.https="https",r.file="file",r.mailto="mailto",r.untitled="untitled",r.data="data",r.command="command",r.vscodeRemote="vscode-remote",r.vscodeRemoteResource="vscode-remote-resource",r.userData="vscode-userdata",r.vscodeCustomEditor="vscode-custom-editor",r.vscodeNotebook="vscode-notebook",r.vscodeNotebookCell="vscode-notebook-cell",r.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",r.vscodeNotebookCellOutput="vscode-notebook-cell-output",r.vscodeInteractive="vscode-interactive",r.vscodeInteractiveInput="vscode-interactive-input",r.vscodeSettings="vscode-settings",r.vscodeWorkspaceTrust="vscode-workspace-trust",r.vscodeTerminal="vscode-terminal",r.webviewPanel="webview-panel",r.vscodeWebview="vscode-webview",r.extension="extension",r.vscodeFileResource="vscode-file",r.tmp="tmp",r.vsls="vsls"})(d=e.Schemas||(e.Schemas={}));class A{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null}setPreferredWebSchema(a){this._preferredWebSchema=a}setDelegate(a){this._delegate=a}set(a,c,h){this._hosts[a]=c,this._ports[a]=h}setConnectionToken(a,c){this._connectionTokens[a]=c}get remoteResourcePath(){if(g.isWeb){const a=m.URI.parse(window.location.toString());return m.URI.joinPath(a,d.vscodeRemoteResource).path}return`/${d.vscodeRemoteResource}`}rewrite(a){if(this._delegate)return this._delegate(a);const c=a.authority;let h=this._hosts[c];h&&h.indexOf(":")!==-1&&(h=`[${h}]`);const u=this._ports[c],l=this._connectionTokens[c];let t=`path=${encodeURIComponent(a.path)}`;return typeof l=="string"&&(t+=`&tkn=${encodeURIComponent(l)}`),m.URI.from({scheme:g.isWeb?this._preferredWebSchema:d.vscodeRemoteResource,authority:`${h}:${u}`,path:this.remoteResourcePath,query:t})}}M([f.memoize],A.prototype,"remoteResourcePath",null),e.RemoteAuthorities=new A;class P{asBrowserUri(a,c){const h=this.toUri(a,c);return h.scheme===d.vscodeRemote?e.RemoteAuthorities.rewrite(h):h.scheme===d.file&&(g.isNative||typeof g.globals.importScripts=="function"&&g.globals.origin===`${d.vscodeFileResource}://${P.FALLBACK_AUTHORITY}`)?h.with({scheme:d.vscodeFileResource,authority:h.authority||P.FALLBACK_AUTHORITY,query:null,fragment:null}):h}asFileUri(a,c){const h=this.toUri(a,c);return h.scheme===d.vscodeFileResource?h.with({scheme:d.file,authority:h.authority!==P.FALLBACK_AUTHORITY?h.authority:null,query:null,fragment:null}):h}toUri(a,c){return m.URI.isUri(a)?a:m.URI.parse(c.toUrl(a))}}P.FALLBACK_AUTHORITY="vscode-app",e.FileAccess=new P}),define(T[9],$([0,1,3,5,8,2,4,6]),function(O,e,f,g,m,d,A,P){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toLocalResource=e.DataUri=e.distinctParents=e.addTrailingPathSeparator=e.removeTrailingPathSeparator=e.hasTrailingPathSeparator=e.isEqualAuthority=e.isAbsolutePath=e.resolvePath=e.relativePath=e.normalizePath=e.joinPath=e.dirname=e.extname=e.basename=e.basenameOrAuthority=e.getComparisonKey=e.isEqualOrParent=e.isEqual=e.extUriIgnorePathCase=e.extUriBiasedIgnorePathCase=e.extUri=e.ExtUri=e.originalFSPath=void 0;function r(l){return(0,P.uriToFsPath)(l,!0)}e.originalFSPath=r;class a{constructor(t){this._ignorePathCasing=t}compare(t,i,o=!1){return t===i?0:(0,A.compare)(this.getComparisonKey(t,o),this.getComparisonKey(i,o))}isEqual(t,i,o=!1){return t===i?!0:!t||!i?!1:this.getComparisonKey(t,o)===this.getComparisonKey(i,o)}getComparisonKey(t,i=!1){return t.with({path:this._ignorePathCasing(t)?t.path.toLowerCase():void 0,fragment:i?null:void 0}).toString()}ignorePathCasing(t){return this._ignorePathCasing(t)}isEqualOrParent(t,i,o=!1){if(t.scheme===i.scheme){if(t.scheme===g.Schemas.file)return f.isEqualOrParent(r(t),r(i),this._ignorePathCasing(t))&&t.query===i.query&&(o||t.fragment===i.fragment);if((0,e.isEqualAuthority)(t.authority,i.authority))return f.isEqualOrParent(t.path,i.path,this._ignorePathCasing(t),"/")&&t.query===i.query&&(o||t.fragment===i.fragment)}return!1}joinPath(t,...i){return P.URI.joinPath(t,...i)}basenameOrAuthority(t){return(0,e.basename)(t)||t.authority}basename(t){return m.posix.basename(t.path)}extname(t){return m.posix.extname(t.path)}dirname(t){if(t.path.length===0)return t;let i;return t.scheme===g.Schemas.file?i=P.URI.file(m.dirname(r(t))).path:(i=m.posix.dirname(t.path),t.authority&&i.length&&i.charCodeAt(0)!==47&&(console.error(`dirname("${t.toString})) resulted in a relative path`),i="/")),t.with({path:i})}normalizePath(t){if(!t.path.length)return t;let i;return t.scheme===g.Schemas.file?i=P.URI.file(m.normalize(r(t))).path:i=m.posix.normalize(t.path),t.with({path:i})}relativePath(t,i){if(t.scheme!==i.scheme||!(0,e.isEqualAuthority)(t.authority,i.authority))return;if(t.scheme===g.Schemas.file){const b=m.relative(r(t),r(i));return d.isWindows?f.toSlashes(b):b}let o=t.path||"/",v=i.path||"/";if(this._ignorePathCasing(t)){let b=0;for(const w=Math.min(o.length,v.length);b<w&&!(o.charCodeAt(b)!==v.charCodeAt(b)&&o.charAt(b).toLowerCase()!==v.charAt(b).toLowerCase());b++);o=v.substr(0,b)+o.substr(b)}return m.posix.relative(o,v)}resolvePath(t,i){if(t.scheme===g.Schemas.file){const o=P.URI.file(m.resolve(r(t),i));return t.with({authority:o.authority,path:o.path})}return i=f.toPosixPath(i),t.with({path:m.posix.resolve(t.path,i)})}isAbsolutePath(t){return!!t.path&&t.path[0]==="/"}isEqualAuthority(t,i){return t===i||t!==void 0&&i!==void 0&&(0,A.equalsIgnoreCase)(t,i)}hasTrailingPathSeparator(t,i=m.sep){if(t.scheme===g.Schemas.file){const o=r(t);return o.length>f.getRoot(o).length&&o[o.length-1]===i}else{const o=t.path;return o.length>1&&o.charCodeAt(o.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(t.fsPath)}}removeTrailingPathSeparator(t,i=m.sep){return(0,e.hasTrailingPathSeparator)(t,i)?t.with({path:t.path.substr(0,t.path.length-1)}):t}addTrailingPathSeparator(t,i=m.sep){let o=!1;if(t.scheme===g.Schemas.file){const v=r(t);o=v!==void 0&&v.length===f.getRoot(v).length&&v[v.length-1]===i}else{i="/";const v=t.path;o=v.length===1&&v.charCodeAt(v.length-1)===47}return!o&&!(0,e.hasTrailingPathSeparator)(t,i)?t.with({path:t.path+"/"}):t}}e.ExtUri=a,e.extUri=new a(()=>!1),e.extUriBiasedIgnorePathCase=new a(l=>l.scheme===g.Schemas.file?!d.isLinux:!0),e.extUriIgnorePathCase=new a(l=>!0),e.isEqual=e.extUri.isEqual.bind(e.extUri),e.isEqualOrParent=e.extUri.isEqualOrParent.bind(e.extUri),e.getComparisonKey=e.extUri.getComparisonKey.bind(e.extUri),e.basenameOrAuthority=e.extUri.basenameOrAuthority.bind(e.extUri),e.basename=e.extUri.basename.bind(e.extUri),e.extname=e.extUri.extname.bind(e.extUri),e.dirname=e.extUri.dirname.bind(e.extUri),e.joinPath=e.extUri.joinPath.bind(e.extUri),e.normalizePath=e.extUri.normalizePath.bind(e.extUri),e.relativePath=e.extUri.relativePath.bind(e.extUri),e.resolvePath=e.extUri.resolvePath.bind(e.extUri),e.isAbsolutePath=e.extUri.isAbsolutePath.bind(e.extUri),e.isEqualAuthority=e.extUri.isEqualAuthority.bind(e.extUri),e.hasTrailingPathSeparator=e.extUri.hasTrailingPathSeparator.bind(e.extUri),e.removeTrailingPathSeparator=e.extUri.removeTrailingPathSeparator.bind(e.extUri),e.addTrailingPathSeparator=e.extUri.addTrailingPathSeparator.bind(e.extUri);function c(l,t){const i=[];for(let o=0;o<l.length;o++){const v=t(l[o]);l.some((b,w)=>w===o?!1:(0,e.isEqualOrParent)(v,t(b)))||i.push(l[o])}return i}e.distinctParents=c;var h;(function(l){l.META_DATA_LABEL="label",l.META_DATA_DESCRIPTION="description",l.META_DATA_SIZE="size",l.META_DATA_MIME="mime";function t(i){const o=new Map;i.path.substring(i.path.indexOf(";")+1,i.path.lastIndexOf(";")).split(";").forEach(w=>{const[C,L]=w.split(":");C&&L&&o.set(C,L)});const b=i.path.substring(0,i.path.indexOf(";"));return b&&o.set(l.META_DATA_MIME,b),o}l.parseMetaData=t})(h=e.DataUri||(e.DataUri={}));function u(l,t,i){if(t){let o=l.path;return o&&o[0]!==m.posix.sep&&(o=m.posix.sep+o),l.with({scheme:i,authority:t,path:o})}return l.with({scheme:i})}e.toLocalResource=u}),define(T[11],$([0,1,6,3,9,4,12,2,5]),function(O,e,f,g,m,d,A,P,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.create=e.OutputLinkComputer=void 0;class a{constructor(u,l){this.ctx=u,this.patterns=new Map,this.computePatterns(l)}computePatterns(u){const l=u.workspaceFolders.sort((t,i)=>i.length-t.length).map(t=>f.URI.parse(t));for(const t of l){const i=a.createPatterns(t);this.patterns.set(t,i)}}getModel(u){return this.ctx.getMirrorModels().find(t=>t.uri.toString()===u)}computeLinks(u){const l=this.getModel(u);if(!l)return[];const t=[],i=d.splitLines(l.getValue());for(const[o,v]of this.patterns){const b={toResource:w=>typeof w=="string"?m.joinPath(o,w):null};for(let w=0,C=i.length;w<C;w++)t.push(...a.detectLinks(i[w],w+1,v,b))}return t}static createPatterns(u){const l=[],t=u.scheme===r.Schemas.file?u.fsPath:u.path,i=[t];P.isWindows&&u.scheme===r.Schemas.file&&i.push(g.toSlashes(t));for(const o of i){const v='[^\\s\\(\\):<>"]',w=`${`(?:${v}| ${v})`}+\\.${v}+`,C=`${v}+`;l.push(new RegExp(d.escapeRegExpCharacters(o)+`(${w}) on line ((\\d+)(, column (\\d+))?)`,"gi")),l.push(new RegExp(d.escapeRegExpCharacters(o)+`(${w}):line ((\\d+)(, column (\\d+))?)`,"gi")),l.push(new RegExp(d.escapeRegExpCharacters(o)+`(${w})(\\s?\\((\\d+)(,(\\d+))?)\\)`,"gi")),l.push(new RegExp(d.escapeRegExpCharacters(o)+`(${C})(:(\\d+))?(:(\\d+))?`,"gi"))}return l}static detectLinks(u,l,t,i){const o=[];return t.forEach(v=>{v.lastIndex=0;let b,w=0;for(;(b=v.exec(u))!==null;){const C=d.rtrim(b[1],".").replace(/\\/g,"/");let L;try{const s=i.toResource(C);s&&(L=s.toString())}catch(s){continue}if(b[3]){const s=b[3];if(b[5]){const R=b[5];L=d.format("{0}#{1},{2}",L,s,R)}else L=d.format("{0}#{1}",L,s)}const I=d.rtrim(b[0],"."),q=u.indexOf(I,w);w=q+I.length;const n={startColumn:q+1,startLineNumber:l,endColumn:q+1+I.length,endLineNumber:l};if(o.some(s=>A.Range.areIntersectingOrTouching(s.range,n)))return;o.push({range:n,url:L})}}),o}}e.OutputLinkComputer=a;function c(h,u){return new a(h,u)}e.create=c})}).call(this); //# sourceMappingURL=outputLinkComputer.js.map