/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/importurifrom'vs/base/common/uri';importpaths=require('vs/base/common/paths');exportclassSource{publicuri:uri;publicinMemory:boolean;publicavailable:boolean;privatestaticINTERNAL_URI_PREFIX='debug://internal/';constructor(publicname:string,uriStr:string,publicreference=0){this.uri=uri.parse(uriStr);this.inMemory=uriStr.indexOf(Source.INTERNAL_URI_PREFIX)===0;this.available=true;}publictoRawSource():DebugProtocol.Source{returnthis.inMemory?{name:this.name}:{path:paths.normalize(this.uri.fsPath,true)};}publicstaticfromRawSource(rawSource:DebugProtocol.Source):Source{varuriStr=rawSource.path?uri.file(rawSource.path).toString():Source.INTERNAL_URI_PREFIX+rawSource.name;returnnewSource(rawSource.name,uriStr,rawSource.sourceReference);}publicstaticfromUri(uri:uri):Source{varuriStr=uri.toString();returnnewSource(uriStr.substr(uriStr.lastIndexOf('/')+1),uriStr);}}