From 1c978408a85911afe7ea70734607c997deffb26c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 15 Jul 2021 22:46:41 +0000 Subject: [PATCH] chore(release): 1.0.2 [skip ci] --- CHANGELOG.md | 9 +++++++++ dist/main.js | 2 +- dist/main.js.map | 2 +- dist/src/CodeFormatManager.d.ts | 6 +++--- dist/src/utils.d.ts | 2 ++ dist/tsconfig.tsbuildinfo | 2 +- package.json | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 dist/src/utils.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 39da4cb..fe1044a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [1.0.2](https://github.com/atom-community/atom-ide-code-format/compare/v1.0.1...v1.0.2) (2021-07-15) + + +### Bug Fixes + +* fix and optimize _formatCodeInTextEditor ([2607425](https://github.com/atom-community/atom-ide-code-format/commit/2607425a8516718d67c9506fc8e233852e194c7e)) +* optimize _formatCodeOnTypeInTextEditor ([16009d4](https://github.com/atom-community/atom-ide-code-format/commit/16009d4b247129ca599ce16165866d35aade1ba1)) +* set save on type to false ([29b83d3](https://github.com/atom-community/atom-ide-code-format/commit/29b83d354dbdc5f2a5ff44e31e285e899c60f60c)) + ## [1.0.1](https://github.com/atom-community/atom-ide-code-format/compare/v1.0.0...v1.0.1) (2021-07-15) diff --git a/dist/main.js b/dist/main.js index 9b56aed..0f01a95 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1,2 +1,2 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("atom"),t=require("rxjs-compat/bundles/rxjs-compat.umd.min.js"),r=require("assert"),n=require("log4js"),o=require("path"),i=require("os");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(e),u=s(t),l=s(r),c=s(n),d=s(o),f=s(i);var h={},p={},m={};Object.defineProperty(m,"__esModule",{value:!0}),m.default=function(e){if("string"==typeof e.displayName&&""!==e.displayName)return e.displayName;if("string"==typeof e.name&&""!==e.name)return e.name;return"Unknown"};var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.default=void 0;class v{constructor(...e){this.disposed=void 0,this.teardowns=void 0,this.teardowns=new Set,this.disposed=!1,e.length&&this.add(...e)}add(...e){if(this.disposed)throw new Error("Cannot add to an already disposed UniversalDisposable!");for(let t=0;t{r.dispose(),this.remove(r)})));this.add(r)}remove(e){this.disposed||this.teardowns.delete(e)}dispose(){this.disposed||(this.disposed=!0,this.teardowns.forEach((e=>{"function"==typeof e.dispose?e.dispose():"function"==typeof e.unsubscribe?e.unsubscribe():"function"==typeof e.destroy?e.destroy():"function"==typeof e&&e()})),this.teardowns=null)}unsubscribe(){this.dispose()}clear(){this.disposed||this.teardowns.clear()}}function y(e){if("function"!=typeof e.dispose&&"function"!=typeof e.unsubscribe&&"function"!=typeof e.destroy&&"function"!=typeof e)throw new TypeError("Arguments to UniversalDisposable.add must be disposable")}g.default=v;var _={};Object.defineProperty(_,"__esModule",{value:!0}),_.sleep=b,_.nextTick=function(){return new Promise((e=>{process.nextTick(e)}))},_.triggerAfterWait=async function(e,t,r,n){const o=setTimeout(r,t);try{return await e}finally{clearTimeout(o),n&&n()}},_.timeoutPromise=x,_.createDeadline=function(e){return Date.now()+e},_.timeoutAfterDeadline=function(e,t){const r=e-Date.now();return x(t,r<0?0:r)},_.retryLimit=async function(e,t,r,n=0){let o=null,i=0,s=null;for(;0===i||i{const t=e();return r=t.then((()=>r=null),(()=>r=null)),t},o=()=>(t=null,n());return()=>null==r?n():(null==t&&((0,P.default)(r,"pendingCall must not be null!"),t=r.then(o,o)),t)},_.asyncFind=function(e,t,r){let n=e;return new Promise(((e,o)=>{n=n.slice();const i=n.length,s=async function(o){if(o===i)return void e(null);const a=n[o],u=await t.call(r,a);null!=u?e(u):s(o+1)};s(0)}))},_.denodeify=function(e){return function(...t){return new Promise(((r,n)=>{e.apply(this,t.concat([function(e,t){e?n(e):r(t)}]))}))}},_.asyncLimit=E,_.asyncFilter=async function(e,t,r){const n=[];return await E(e,r||e.length,(async e=>{await t(e)&&n.push(e)})),n},_.asyncObjFilter=async function(e,t,r){const n=Object.keys(e),o={};return await E(n,r||n.length,(async r=>{const n=e[r];await t(n,r)&&(o[r]=n)})),o},_.asyncSome=async function(e,t,r){let n=!1;return await E(e,r||e.length,(async e=>{n||await t(e)&&(n=!0)})),n},_.isPromise=function(e){return Boolean(e)&&"object"==typeof e&&"function"==typeof e.then},_.lastly=function(e,t){return e.then((e=>Promise.resolve(t()).then((()=>e))),(e=>Promise.resolve(t()).then((()=>Promise.reject(e)))))},_.delayTime=function(e){return new Promise(((t,r)=>{setTimeout(t,e)}))},_.PromiseWithState=_.Deferred=_.TimedOutError=_.RequestSerializer=void 0;var w,P=(w=l.default)&&w.__esModule?w:{default:w};function b(e){return new Promise((t=>{setTimeout(t,e)}))}_.RequestSerializer=class{constructor(){this._lastDispatchedOp=void 0,this._lastFinishedOp=void 0,this._latestPromise=void 0,this._waitResolve=void 0,this._lastDispatchedOp=0,this._lastFinishedOp=0,this._latestPromise=new Promise(((e,t)=>{this._waitResolve=e}))}async run(e){const t=this._lastDispatchedOp+1;this._lastDispatchedOp=t,this._latestPromise=e,this._waitResolve();const r=await e;return this._lastFinishedOp{this._waitResolve=e,this._latestPromise.then(e)}));return t}isRunInProgress(){return this._lastDispatchedOp>this._lastFinishedOp}};class T extends Error{constructor(e){super(`Timed out after ${String(e)} ms`),this.timeout=void 0,this.timeout=e}}function x(e,t){return new Promise(((r,n)=>{let o=setTimeout((()=>{o=null,n(new T(t))}),t);e.then((e=>{null!=o&&clearTimeout(o),r(e)})).catch((e=>{null!=o&&clearTimeout(o),n(e)}))}))}_.TimedOutError=T;function E(e,t,r){const n=new Array(e.length);let o=0,i=0,s=Math.min(t,e.length)||1;return new Promise(((t,a)=>{const u=async()=>{if(i===e.length)return void(0===o&&t(n));++o;const s=i++;try{n[s]=await r(e[s])}catch(e){a(e)}--o,u()};for(;s--;)u()}))}_.Deferred=class{constructor(){this.promise=void 0,this.resolve=void 0,this.reject=void 0,this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}};_.PromiseWithState=class{constructor(e){this._promise=void 0,this._state=void 0,this._state={kind:"pending"},this._promise=e.then((e=>(this._state={kind:"fulfilled",value:e},e)),(e=>{throw this._state={kind:"rejected",error:e},e}))}getPromise(){return this._promise}getState(){return this._state}};var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.default=void 0;var O="undefined"!=typeof performance?()=>performance.now():()=>{const[e,t]=process.hrtime();return 1e3*e+t/1e6};S.default=O,Object.defineProperty(p,"__esModule",{value:!0}),p.track=F,p.isTrackSupported=function(){return U.isTrackSupported()},p.trackImmediate=function(e,t){return U.track(e,t||{},!0)||Promise.resolve()},p.trackEvent=$,p.trackEvents=function(e){return new R.default(e.subscribe($))},p.trackSampled=M,p.startTracking=L,p.trackTiming=N,p.decorateTrackTiming=B,p.trackTimingSampled=W,p.decorateTrackTimingSampled=q,p.setRawAnalyticsService=function(e,t){e.setApplicationSessionObservable(t),U=e},p.default=p.TimingTracker=void 0;var k=j(m),R=j(g),C=_,A=j(S);function j(e){return e&&e.__esModule?e:{default:e}}let U={track(){},isTrackSupported:()=>!1,setApplicationSessionObservable:e=>{}};function F(e,t){U.track(e,t||{})}function $(e){F(e.type,e.data)}function M(e,t,r){Math.random()*t<=1&&U.track(e,{...r,sample_rate:t})}const I="undefined"!=typeof performance;class D{constructor(e,t){this._eventName=void 0,this._startTime=void 0,this._startMark=void 0,this._values=void 0,this._eventName=e,this._startMark=`${this._eventName}_${D.eventCount++}_start`,this._startTime=(0,A.default)(),this._values=t,I&&performance.mark(this._startMark)}onError(e){this._trackTimingEvent(e)}onCancel(){this._trackTimingEvent(null,!0)}onSuccess(){this._trackTimingEvent(null)}_trackTimingEvent(e,t=!1){I&&(performance.measure(this._eventName,this._startMark),performance.clearMarks(this._startMark),performance.clearMeasures(this._eventName)),F("performance",{...this._values,duration:Math.round((0,A.default)()-this._startTime).toString(),eventName:this._eventName,error:e?"1":"0",exception:e?e.toString():"",canceled:t})}}function L(e,t={}){return new D(e,t)}function N(e,t,r={}){const n=L(e,r);try{const e=t();return(0,C.isPromise)(e)?e.then((e=>(n.onSuccess(),e)),(e=>(n.onError(e instanceof Error?e:new Error(e)),Promise.reject(e)))):(n.onSuccess(),e)}catch(e){throw n.onError(e),e}}function B(e,t={}){const r=(0,k.default)(e);function n(...n){return N(r,e.bind(this,...n),t)}return n.displayName=`trackTiming(${r})`,n}function W(e,t,r,n={}){return Math.random()*r<=1?N(e,t,{...n,sample_rate:r}):t()}function q(e,t,r={}){const n=(0,k.default)(e);function o(...o){return W(n,e.bind(this,...o),t,r)}return o.displayName=`trackTimingSampled(${n})`,o}p.TimingTracker=D,D.eventCount=0;var H={track:F,trackSampled:M,trackEvent:$,trackTiming:N,trackTimingSampled:W,startTracking:L,TimingTracker:D,decorateTrackTiming:B,decorateTrackTimingSampled:q};p.default=H;var z={};Object.defineProperty(z,"__esModule",{value:!0}),z.default=void 0;var G=function(e){return e&&e.__esModule?e:{default:e}}(g);z.default=class{constructor(){this._providers=void 0,this._providers=[]}addProvider(e){const t=this._providers.findIndex((t=>e.priority>t.priority));return-1===t?this._providers.push(e):this._providers.splice(t,0,e),new G.default((()=>{this.removeProvider(e)}))}removeProvider(e){const t=this._providers.indexOf(e);-1!==t&&this._providers.splice(t,1)}getProviderForEditor(e){const t=e.getGrammar().scopeName;return this.findProvider(t)}getAllProvidersForEditor(e){const t=e.getGrammar().scopeName;return this.findAllProviders(t)}findProvider(e){for(const t of this.findAllProviders(e))return t;return null}*findAllProviders(e){for(const t of this._providers)null!=t.grammarScopes&&-1===t.grammarScopes.indexOf(e)||(yield t)}};var V={},J={},X={};Object.defineProperty(X,"__esModule",{value:!0}),X.attachEvent=function(e,t,r){return e.addListener(t,r),new Z.default((()=>{e.removeListener(t,r)}))},X.observableFromSubscribeFunction=function(e){return K.Observable.create((t=>new Z.default(e(t.next.bind(t)))))};var Z=function(e){return e&&e.__esModule?e:{default:e}}(g),K=u.default;Object.defineProperty(J,"__esModule",{value:!0}),J.existingEditorForUri=function(e){for(const t of atom.workspace.getTextEditors())if(t.getPath()===e)return t;return null},J.existingEditorForBuffer=function(e){for(const t of atom.workspace.getTextEditors())if(t.getBuffer()===e)return t;return null},J.getViewOfEditor=re,J.getScrollTop=function(e){return re(e).getScrollTop()},J.setScrollTop=ne,J.setPositionAndScroll=function(e,t,r){e.setCursorBufferPosition(t,{autoscroll:!1}),ne(e,r)},J.getCursorPositions=function(e){return ee.Observable.defer((()=>{const t=e.getCursors()[0];return(0,Q.default)(null!=t),ee.Observable.merge(ee.Observable.of(t.getBufferPosition()),(0,te.observableFromSubscribeFunction)(t.onDidChangePosition.bind(t)).map((e=>e.newBufferPosition)))}))},J.observeEditorDestroy=function(e){return(0,te.observableFromSubscribeFunction)(e.onDidDestroy.bind(e)).map((t=>e)).take(1)},J.enforceReadOnlyEditor=function(e,t=["append","setText"]){return e.getElement().setAttribute("readonly",""),{dispose(){e.getElement().removeAttribute("readonly")}}},J.enforceSoftWrap=function(e,t){return e.setSoftWrapped(t),e.onDidChangeSoftWrapped((r=>{r!==t&&process.nextTick((()=>{e.isDestroyed()||e.setSoftWrapped(t)}))}))},J.isValidTextEditor=function(e){return e instanceof Y.TextEditor},J.centerScrollToBufferLine=function(e,t){const r=e.getModel(),n=e.pixelPositionForBufferPosition([t,0]).top+r.getLineHeightInPixels()/2-e.clientHeight/2;e.setScrollTop(Math.max(n,1)),e.focus(),r.setCursorBufferPosition([t,0],{autoscroll:!1})};var Q=function(e){return e&&e.__esModule?e:{default:e}}(l.default),Y=a.default,ee=u.default,te=X;function re(e){return atom.views.getView(e)}function ne(e,t){re(e).setScrollTop(t)}var oe={};Object.defineProperty(oe,"__esModule",{value:!0}),oe.goToLocation=async function(e,t){var r,n,o;const i=null===(r=null==t?void 0:t.center)||void 0===r||r,s=null===(n=null==t?void 0:t.moveCursor)||void 0===n||n,a=null===(o=null==t?void 0:t.activatePane)||void 0===o||o,u=null==t?void 0:t.activateItem,l=null==t?void 0:t.line,c=null==t?void 0:t.column,d=null==t?void 0:t.pending,f=atom.workspace.getActiveTextEditor();if(null!=f&&f.getPath()===e){const e=atom.workspace.paneContainerForItem(f);return(0,ae.default)(null!=e),a&&e.activate(),null!=l?le(f,{line:l,column:null==c?0:c,center:i,moveCursor:s}):(0,ae.default)(null==c,"goToLocation: Cannot specify just column"),f}{const t=await atom.workspace.open(e,{initialLine:l,initialColumn:c,searchAllPanes:!0,activatePane:a,activateItem:u,pending:d});if(null==t){const t={};Error.captureStackTrace(t);const r=Error(`atom.workspace.open returned null on ${e}`);throw(0,ie.getLogger)("goToLocation").error(r),r}return i&&null!=l&&t.scrollToBufferPosition([l,c],{center:!0}),t}},oe.goToLocationInEditor=le,oe.observeNavigatingEditors=function(){return ue};var ie=c.default,se=u.default,ae=function(e){return e&&e.__esModule?e:{default:e}}(l.default);const ue=new se.Subject;function le(e,t){const r=null==t.center||t.center,n=null==t.moveCursor||t.moveCursor,{line:o,column:i}=t;n&&e.setCursorBufferPosition([o,i]),r&&e.scrollToBufferPosition([o,i],{center:!0}),ue.next(e)}Object.defineProperty(V,"__esModule",{value:!0}),V.applyTextEditsForMultipleFiles=async function(e){const t=Array.from(e.keys()),r=(await Promise.all(t.map((async e=>(0,pe.goToLocation)(e))))).map((e=>{(0,de.default)(null!=e);const t=e.getBuffer();return[t,t.createCheckpoint()]})),n=t.reduce(((t,r)=>{const n=e.get(r);return t&&null!=n&&me(r,...n)}),!0);n||r.forEach((([e,t])=>(e.revertToCheckpoint(t),!1)));return n},V.applyTextEdits=me;var ce=V.applyTextEditsToBuffer=function(e,t){return ge(e,ye(t))},de=function(e){return e&&e.__esModule?e:{default:e}}(l.default),fe=c.default,he=J,pe=oe;function me(e,...t){const r=ye(t),n=(0,he.existingEditorForUri)(e);return(0,de.default)(null!=n),ge(n.getBuffer(),r)}function ge(e,t){if(function(e){for(let t=0;t=0;n--){if(!ve(e,t[n]))return e.revertToCheckpoint(r),!1}return e.groupChangesSinceCheckpoint(r),!0}function ve(e,t){if(t.oldRange.start.row===t.oldRange.end.row){const r=e.lineLengthForRow(t.oldRange.start.row);if(t.oldRange.end.column>r)return!1}if(null!=t.oldText){if(e.getTextInRange(t.oldRange)!==t.oldText)return!1}return e.setTextInRange(t.oldRange,t.newText),!0}function ye(e){return e.map(((e,t)=>[e,t])).sort((([e,t],[r,n])=>e.oldRange.start.compare(r.oldRange.start)||e.oldRange.end.compare(r.oldRange.end)||t-n)).map((([e])=>e))}Object.defineProperty(h,"__esModule",{value:!0});var _e=h.registerOnWillSave=function(e){return Se.addProvider(e)};h.observeTextEditors=function(){const e=new xe.default;return e.add(atom.workspace.observeTextEditors((t=>{e.add(function(e){const t=e.save,r=e;return r.save=async()=>{const n=new Date;n.setTime(n.getTime()+5e3);try{await function(e){if(null==e.getPath())return we.Observable.empty();const t=Array.from(Se.getAllProvidersForEditor(e));return we.Observable.concat(...t.map((t=>t.callback(e).toArray().race(we.Observable.of([]).delay(t.timeout)).map((t=>(0,Te.applyTextEditsToBuffer)(e.getBuffer(),t))))))}(r).timeout(n).toPromise()}catch(t){const n=Array.from(Se.getAllProvidersForEditor(r));(0,Pe.track)("timeout-on-save",{uri:e.getPath(),providers:n})}finally{await t.call(e)}},new xe.default((()=>{r.save=t}))}(t))}))),e};var we=u.default,Pe=p,be=Ee(z),Te=V,xe=Ee(g);function Ee(e){return e&&e.__esModule?e:{default:e}}const Se=new be.default;var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0});var ke=Oe.ProviderRegistry=void 0;const Re=a.default;ke=Oe.ProviderRegistry=class{constructor(){this.providers=[]}addProvider(e){const t=this.providers.findIndex((t=>e.priority>t.priority));return-1===t?this.providers.push(e):this.providers.splice(t,0,e),new Re.Disposable((()=>{this.removeProvider(e)}))}removeProvider(e){const t=this.providers.indexOf(e);-1!==t&&this.providers.splice(t,1)}getProviderForEditor(e){const t=e.getGrammar().scopeName;return this.findProvider(t)}getAllProvidersForEditor(e){const t=e.getGrammar().scopeName;return this.findAllProviders(t)}findProvider(e){for(const t of this.findAllProviders(e))return t;return null}*findAllProviders(e){for(const t of this.providers)null!=t.grammarScopes&&-1===t.grammarScopes.indexOf(e)||(yield t)}};var Ce,Ae,je={},Ue={exports:{}};Ce=Ue,void 0!==(Ae=function(e,t){function r(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return encodeURIComponent(e).replace(/[!'()*]/g,r)}function o(e){return e.replace(/[#?]/,r)}Object.defineProperty(t,"__esModule",{value:!0});var i,s=function(){function e(){this._scheme=e._empty,this._authority=e._empty,this._path=e._empty,this._query=e._empty,this._fragment=e._empty,this._formatted=null,this._fsPath=null}return e.isUri=function(t){return t instanceof e||!!t&&"string"==typeof t.authority&&"string"==typeof t.fragment&&"string"==typeof t.path&&"string"==typeof t.query&&"string"==typeof t.scheme},Object.defineProperty(e.prototype,"scheme",{get:function(){return this._scheme},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authority",{get:function(){return this._authority},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._path},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fragment",{get:function(){return this._fragment},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fsPath",{get:function(){var t;return this._fsPath||(t=this._authority&&this._path&&"file"===this.scheme?"//"+this._authority+this._path:e._driveLetterPath.test(this._path)?this._path[1].toLowerCase()+this._path.substr(2):this._path,i&&(t=t.replace(/\//g,"\\")),this._fsPath=t),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.with=function(t){if(!t)return this;var r=t.scheme,n=t.authority,o=t.path,i=t.query,s=t.fragment;if(void 0===r?r=this.scheme:null===r&&(r=""),void 0===n?n=this.authority:null===n&&(n=""),void 0===o?o=this.path:null===o&&(o=""),void 0===i?i=this.query:null===i&&(i=""),void 0===s?s=this.fragment:null===s&&(s=""),r===this.scheme&&n===this.authority&&o===this.path&&i===this.query&&s===this.fragment)return this;var a=new e;return a._scheme=r,a._authority=n,a._path=o,a._query=i,a._fragment=s,e._validate(a),a},e.parse=function(t){var r=new e,n=e._parseComponents(t);return r._scheme=n.scheme,r._authority=decodeURIComponent(n.authority),r._path=decodeURIComponent(n.path),r._query=decodeURIComponent(n.query),r._fragment=decodeURIComponent(n.fragment),e._validate(r),r},e.file=function(t){var r=new e;if(r._scheme="file",i&&(t=t.replace(/\\/g,e._slash)),t[0]===e._slash&&t[0]===t[1]){var n=t.indexOf(e._slash,2);-1===n?r._authority=t.substring(2):(r._authority=t.substring(2,n),r._path=t.substring(n))}else r._path=t;return r._path[0]!==e._slash&&(r._path=e._slash+r._path),e._validate(r),r},e._parseComponents=function(t){var r={scheme:e._empty,authority:e._empty,path:e._empty,query:e._empty,fragment:e._empty},n=e._regexp.exec(t);return n&&(r.scheme=n[2]||r.scheme,r.authority=n[4]||r.authority,r.path=n[5]||r.path,r.query=n[7]||r.query,r.fragment=n[9]||r.fragment),r},e.from=function(t){return(new e).with(t)},e._validate=function(t){if(t.scheme&&!e._schemePattern.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!e._singleSlashStart.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(e._doubleSlashStart.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')},e.prototype.toString=function(t){return void 0===t&&(t=!1),t?e._asFormatted(this,!0):(this._formatted||(this._formatted=e._asFormatted(this,!1)),this._formatted)},e._asFormatted=function(t,r){var i=r?o:n,s=[],a=t.scheme,u=t.authority,l=t.path,c=t.query,d=t.fragment;if(a&&s.push(a,":"),(u||"file"===a)&&s.push("//"),u&&(-1===(p=(u=u.toLowerCase()).indexOf(":"))?s.push(i(u)):s.push(i(u.substr(0,p)),u.substr(p))),l){var f=e._upperCaseDrive.exec(l);f&&(l=f[1]?"/"+f[2].toLowerCase()+l.substr(3):f[2].toLowerCase()+l.substr(2));for(var h=0;;){var p;if(-1===(p=l.indexOf(e._slash,h))){s.push(i(l.substring(h)));break}s.push(i(l.substring(h,p)),e._slash),h=p+1}}return c&&s.push("?",i(c)),d&&s.push("#",i(d)),s.join(e._empty)},e.prototype.toJSON=function(){var e={fsPath:this.fsPath,external:this.toString(),$mid:1};return this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e},e.revive=function(t){var r=new e;return r._scheme=t.scheme||e._empty,r._authority=t.authority||e._empty,r._path=t.path||e._empty,r._query=t.query||e._empty,r._fragment=t.fragment||e._empty,r._fsPath=t.fsPath,r._formatted=t.external,e._validate(r),r},e}();if(s._empty="",s._slash="/",s._regexp=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,s._driveLetterPath=/^\/[a-zA-z]:/,s._upperCaseDrive=/^(\/)?([A-Z]:)/,s._schemePattern=/^\w[\w\d+.-]*$/,s._singleSlashStart=/^\//,s._doubleSlashStart=/^\/\//,t.default=s,"object"==typeof process)i="win32"===process.platform;else if("object"==typeof navigator){var a=navigator.userAgent;i=a.indexOf("Windows")>=0}}(0,Ue.exports))&&(Ce.exports=Ae);for(var Fe={},$e={quote:function(e){return e.map((function(e){return e&&"object"==typeof e?e.op.replace(/(.)/g,"\\$1"):/["\s]/.test(e)&&!/'/.test(e)?"'"+e.replace(/(['\\])/g,"\\$1")+"'":/["'\s]/.test(e)?'"'+e.replace(/(["\\$`!])/g,"\\$1")+'"':String(e).replace(/([#!"$&'()*,:;<=>?@\[\\\]^`{|}])/g,"\\$1")})).join(" ")}},Me="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","[&;()|<>]"].join("|")+")",Ie="(\\\\['\"|&;()<> \\t]|[^\\s'\"|&;()<> \\t])+",De="",Le=0;Le<4;Le++)De+=(Math.pow(16,8)*Math.random()).toString(16);$e.parse=function(e,t,r){var n=function(e,t,r){var n=new RegExp(["("+Me+")","("+Ie+"|\"((\\\\\"|[^\"])*?)\"|'((\\\\'|[^'])*?)')*"].join("|"),"g"),o=e.match(n).filter(Boolean),i=!1;if(!o)return[];t||(t={});r||(r={});return o.map((function(e,t){if(!i){if("#"===e.charAt(0))return i=!0,{comment:e.substr(1)+o.slice(t+1).join(" ")};if(RegExp("^"+Me+"$").test(e))return{op:e};for(var n="'",a='"',u="$",l=r.escape||"\\",c=!1,d=!1,f="",h=!1,p=0,m=e.length;p/g,">")},Fe.ZERO_WIDTH_SPACE=Fe.ELLIPSIS_CHAR=Fe.URL_REGEX=void 0;var Ne=function(e){return e&&e.__esModule?e:{default:e}}(l.default),Be=$e;const We=36e5,qe=24*We,He=7*qe,ze=365*qe,Ge=ze/12,Ve=[[42e3,"now"],[9e4,"1m"],[36e5,"m",6e4],[54e5,"1h"],[qe,"h",We],[2*qe,"1d"],[7*qe,"d",qe],[1.5*He,"1w"],[Ge,"w",He],[1.5*Ge,"1mo"],[ze,"mo",Ge],[1.5*ze,"1y"],[Number.MAX_VALUE,"y",ze]],Je=[[42e3,"just now"],[9e4,"a minute ago"],[36e5,"minutes ago",6e4],[54e5,"an hour ago"],[qe,"hours ago",We],[2*qe,"yesterday"],[7*qe,"days ago",qe],[1.5*He,"a week ago"],[Ge,"weeks ago",He],[1.5*Ge,"a month ago"],[ze,"months ago",Ge],[1.5*ze,"a year ago"],[Number.MAX_VALUE,"years ago",ze]],Xe=[[42e3,"just now"],[9e4,"1 minute ago"],[36e5,"minutes ago",6e4],[54e5,"1 hour ago"],[qe,"hours ago",We],[2*qe,"yesterday"],[7*qe,"days ago",qe],[1.5*He,"1 week ago"],[Ge,"weeks ago",He],[1.5*Ge,"1 month ago"],[ze,"months ago",Ge],[1.5*ze,"1 year ago"],[Number.MAX_VALUE,"years ago",ze]];Fe.URL_REGEX=/(https?:\/\/(?:www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=!]*|www\.[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=!]*)/;Fe.ELLIPSIS_CHAR="…";Fe.ZERO_WIDTH_SPACE="​",Object.defineProperty(je,"__esModule",{value:!0}),je.__TEST__=Mt=je.default=void 0;var Ze=tt(Ue.exports),Ke=tt(l.default),Qe=tt(d.default),Ye=tt(f.default),et=Fe;function tt(e){return e&&e.__esModule?e:{default:e}}const rt=[],nt=/^[A-Za-z0-9_-]+:\/\/.*/;function ot(e){return e.startsWith("nuclide://")}function it(e){return e.startsWith("atom://")}function st(e,t){return(0,Ke.default)(null!=t&&""!==t,"NuclideUri must include a path."),`nuclide://${e}${t}`}function at(e){if(e.startsWith("nuclide://")){const t=e.substr("nuclide://".length),r=t.indexOf("/");(0,Ke.default)(-1!==r,`Remote URIs must contain a hostname and a path. Failed to parse ${e}`);const n=t.substr(0,r);(0,Ke.default)(""!==n,`Remote URIs must contain a hostname. Failed to parse ${e}`);const o=t.substr(r);return(0,Ke.default)(!At(e),`Path cannot end with archive separator. Failed to parse ${e}`),{hostname:n,path:o}}return(0,Ke.default)(!At(e),`Path cannot end with archive separator. Failed to parse ${e}`),{hostname:null,path:e}}function ut(e){if(!ot(e))throw new Error("Expected remote uri. Got "+e);const t=at(e);return(0,Ke.default)(t.hostname,`Remote Nuclide URIs must contain hostnames, '${(0,et.maybeToString)(t.hostname)}' found while parsing '${e}'`),{hostname:t.hostname,path:t.path}}function lt(e){return at(e).path}function ct(e){return ut(e).hostname}function dt(e,...t){return ft(e,t)}function ft(e,t){Ut(e);const r=St(e);if(ot(e)){const{hostname:n,path:o}=ut(e);return t.splice(0,0,o),Ot(r,t),Rt(r,st(n,r.join.apply(null,t)))}return t.splice(0,0,e),Ot(r,t),Rt(r,r.join.apply(null,t))}function ht(e){Ut(e);const t=St(e);if(ot(e)){const{hostname:r,path:n}=ut(e);return st(r,Rt(t,t.normalize(kt(t,n))))}return Rt(t,t.normalize(kt(t,e)))}function pt(e,t=""){Ut(e);const r=St(e);return Rt(r,r.basename(kt(r,lt(e)),t))}function mt(e){Ut(e);const t=St(e);if(ot(e)){const{hostname:r,path:n}=ut(e);return st(r,Rt(t,t.dirname(kt(t,n))))}return Rt(t,t.dirname(kt(t,e)))}function gt(e){Ut(e);const t=St(e);return Rt(t,t.extname(kt(t,lt(e))))}function vt(e){const t="file://";if(!e.startsWith(t))return null;const r=e.substr(t.length);return function(e){return St(e)===Qe.default.win32}(r)?r:null}function yt(e,t){if(Ut(e),Ut(t),t.length{const r=t(e);return null!=r&&""!==r?r:e}),e)}function Pt(e){return Ut(e),ot(e)?wt(ct(e)):e}function bt(e){Ut(e);const t=St(e);return e.endsWith(t.sep)?e:e+t.sep}function Tt(e){Ut(e);const t=St(e);return e.endsWith(t.sep)}function xt(e){if(Ut(e),ot(e))return!0;return St(e).isAbsolute(e)}function Et(e){return Ut(e),mt(e)===e}function St(e){return(0,Ke.default)(!At(e),`Path cannot end with archive separator. Failed to determine path module for ${e}`),e.startsWith(Qe.default.posix.sep)||e.indexOf("://")>-1?Qe.default.posix:":"===e[1]&&e[2]===Qe.default.win32.sep||e.split(Qe.default.win32.sep).length>e.split(Qe.default.posix.sep).length?Qe.default.win32:Qe.default.posix}function Ot(e,t){return t.forEach(((t,r,n)=>n[r]=kt(e,t))),t}function kt(e,t){return t.indexOf("!")<0?t:rt.reduce(((t,r)=>t.replace(`${r}!`,`${r}!${e.sep}`)),t)}function Rt(e,t){return t.indexOf("!")<0?t:At(r=rt.reduce(((t,r)=>t.replace(`${r}!${e.sep}`,`${r}!`)),t))?r.substring(0,r.length-"!".length):r;var r}function Ct(e,t){return e.lengtht&&"!"===e.charAt(t)&&rt.some((r=>{const n=t-r.length;return e.indexOf(r,n)===n}))}function Ut(e){if(null!=e&&At(e))throw new Error(`Path operation invoked on URI ending with !: ${e}`)}const Ft=new Set([".bmp",".gif",".ico",".jpeg",".jpg",".png",".webp"]);var $t={basename:pt,dirname:mt,extname:gt,stripExtension:function(e){Ut(e);const t=gt(e);return 0===t.length?e:e.slice(0,-1*t.length)},isRemote:ot,isLocal:function(e){return!ot(e)&&!function(e){return nt.test(e)}(e)&&!it(e)},createRemoteUri:st,isInArchive:function(e){if(it(e)||e.indexOf("!")<0)return!1;for(let t=e.indexOf("!");t>=0;t=e.indexOf("!",t+1))if(jt(e,t))return!0;return!1},ancestorOutsideArchive:function(e){for(let t=e.indexOf("!");t>=0;t=e.indexOf("!",t+1))if(jt(e,t))return e.substring(0,t);return e},parse:at,parseRemoteUri:ut,validate:function(e,t){(0,Ke.default)(null!=e,"Unexpected null NuclideUri"),(0,Ke.default)("string"==typeof e,`Unexpected NuclideUri type: ${String(e)}`),ot(e)?(at(e),(0,Ke.default)(!1!==t,"Expected remote NuclideUri")):((0,Ke.default)(""!==e,"NuclideUri must contain a non-empty path"),(0,Ke.default)(!0!==t,"Expected local NuclideUri"))},getPath:lt,getHostname:ct,getHostnameOpt:function(e){return null!=e&&ot(e)?ct(e):null},join:dt,joinArray:ft,archiveJoin:function(e,t){if(Ut(e),!rt.some((t=>e.endsWith(t))))throw new Error(`Cannot archiveJoin with non-archive ${e} and ${t}`);return e+"!"+t},relative:function(e,t){Ut(e);const r=St(e),n=ot(e);if(n!==ot(t)||n&&ct(e)!==ct(t))throw new Error(`Cannot relative urls on different hosts: ${e} and ${t}`);const o=kt(r,n?lt(e):e),i=kt(r,n?lt(t):t);return Rt(r,r.relative(Ct(o,i),Ct(i,o)))},looksLikeImageUri:function(e){const t=gt(e).toLowerCase();return Ft.has(t)},normalize:ht,normalizeDir:function(e){return bt(ht(e))},getParent:function(e){return ht(dt(e,".."))},uriToNuclideUri:function(e){const t=vt(e);if(null!=t)return t;const r=Ze.default.parse(e);return"file"===r.scheme&&r.path?r.fsPath:ot(e)?e:null},nuclideUriToUri:function(e){return Ut(e),ot(e)?e:Ze.default.file(e).toString()},contains:yt,collapse:function(e){return e.filter((t=>!e.some((e=>yt(e,t)&&e!==t))))},nuclideUriToDisplayString:function(e){return Ut(e),ot(e)?`${Pt(e)}:${lt(e)}`:e},nuclideUriToDisplayHostname:Pt,hostnameToDisplayHostname:wt,registerHostnameFormatter:function(e){return _t.push(e),{dispose:()=>{const t=_t.indexOf(e);t>=0&&_t.splice(t,1)}}},ensureTrailingSeparator:bt,trimTrailingSeparator:function(e){Ut(e);const t=St(e);let r=e;for(;r.endsWith(t.sep)&&!Et(r);)r=r.slice(0,-1*t.sep.length);return r},endsWithSeparator:Tt,endsWithEdenDir:function(e){return Ut(e),e.endsWith(".eden")},isAbsolute:xt,isHomeRelative:function(e){return Ut(e),e.startsWith("~")},resolve:function(e,...t){Ut(e);const r=St(e);if(ot(e)){const{hostname:n,path:o}=ut(e);return t.splice(0,0,o),Ot(r,t),st(n,Rt(r,r.resolve.apply(null,t)))}return t.splice(0,0,e),Ot(r,t),Rt(r,r.resolve.apply(null,t))},expandHomeDir:function(e){if(Ut(e),!e.startsWith("~"))return e;const{HOME:t,UserProfile:r}=process.env,n=!ot(e)&&"win32"===Ye.default.platform(),o=n?r:t;return(0,Ke.default)(null!=o),"~"===e?o:e.startsWith("~/")||n&&e.startsWith("~\\")?Qe.default.resolve(o,e.replace("~",".")):e},splitPathList:function(e){(0,Ke.default)(e.indexOf("nuclide://")<0,"Splitting remote URIs is not supported");const t=St(e);return e.split(t.delimiter)},joinPathList:function(e){if(0===e.length)return"";(0,Ke.default)(e.every((e=>!ot(e))),"Joining of remote URIs is not supported");const t=St(e[0]);return e.join(t.delimiter)},ensureLocalPrefix:function(e){Ut(e);const t=St(e);(0,Ke.default)(!ot(e),"Local prefix can not be added to a remote path"),(0,Ke.default)(!xt(e),"Local prefix can not be added to an absolute path");const r=`.${t.sep}`;return e.startsWith(r)?e:r+e},isRoot:Et,parsePath:function(e){Ut(e);const t=St(e),r=t.parse(kt(t,lt(e)));return{root:Rt(t,r.root),dir:Rt(t,r.dir),base:Rt(t,r.base),ext:Rt(t,r.ext),name:Rt(t,r.name)}},split:function(e){const t=[];let r=e,n=mt(r);for(;r!==n;)t.push(pt(r)),r=n,n=mt(r);return xt(e)&&t.push(n),t.reverse(),t},pathSeparatorFor:function(e){return St(e).sep},hasKnownArchiveExtension:function(e){return rt.some((t=>e.endsWith(t)))},ARCHIVE_SEPARATOR:"!",KNOWN_ARCHIVE_EXTENSIONS:rt,NUCLIDE_URI_TYPE_NAME:"NuclideUri"},Mt=je.default=$t;const It={_pathModuleFor:St};je.__TEST__=It;class Dt{constructor(){this._subscriptions=new e.CompositeDisposable(atom.commands.add("atom-text-editor","code-format:format-code",(async e=>{const t=e.currentTarget.getModel(),r=await this._formatCodeInTextEditor(t);try{if(!ce(t.getBuffer(),r))throw new Error("No code formatting providers found!")}catch(e){atom.notifications.addError(`Failed to format code: ${e.message}`,{detail:e.detail})}})),atom.workspace.observeTextEditors((e=>{const t=e.getBuffer().onDidStopChanging((async t=>{try{await this._formatCodeOnTypeInTextEditor(e,t)}catch(e){n.getLogger("code-format").warn("Failed to format code on type:",e)}}));e.onDidDestroy((()=>t.dispose()))})),_e((()=>({priority:0,timeout:2500,callback:this._formatCodeOnSaveInTextEditor.bind(this)})))),this._rangeProviders=new ke,this._fileProviders=new ke,this._onTypeProviders=new ke,this._onSaveProviders=new ke}async _formatCodeInTextEditor(t,r){const n=t.getBuffer(),o=null!=r?r:t.getSelectedBufferRange(),{start:i,end:s}=o;let a;a=o.isEmpty()?n.getRange():new e.Range([i.row,0],0===s.column?s:[s.row+1,0]);const u=[...this._rangeProviders.getAllProvidersForEditor(t)],l=[...this._fileProviders.getAllProvidersForEditor(t)],c=t.getText(),d=(await this._reportBusy(t,Promise.all(u.map((e=>e.formatCode(t,a)))))).filter((e=>e.length>0)),f=(await this._reportBusy(t,Promise.all(l.map((e=>e.formatEntireFile(t,a)))))).filter((e=>null!=e)).map((({formatted:e})=>[{oldRange:t.getBuffer().getRange(),newText:e,oldText:c}]));return(a.isEqual(n.getRange())?f.concat(d):d.concat(f)).flat()}async _formatCodeOnTypeInTextEditor(e,t){if(1!==t.changes.length)return[];const r=t.changes[0];if(!function(e){if(""!==e.oldText)return!1;if(""===e.newText)return!1;if(e.newText.length>1&&!function(e){if(void 0===atom.packages.getActivePackage("bracket-matcher"))return!1;return atom.config.get("bracket-matcher.autocompleteCharacters").includes(e)}(e.newText))return!1;return!0}(r)||!atom.config.get("atom-ide-code-format.formatOnType"))return[];const n=r.newText[r.newText.length-1],o=[...this._onTypeProviders.getAllProvidersForEditor(e)];if(0===o.length)return[];const i=e.getText(),s=e.getCursorBufferPosition().copy(),a=await Promise.all(o.map((t=>t.formatAtPosition(e,e.getCursorBufferPosition(),n)))),u=a.findIndex((e=>e.length>0));if(-1===u)return[];{const t=a[u],r=o[u];if(function(e,t){if(e!==t)throw new Error("The file contents were changed before formatting was complete.")}(i,e.getText()),!ce(e.getBuffer(),t))throw new Error("Could not apply edits to text buffer.");return r.keepCursorPosition&&e.setCursorBufferPosition(s),t}}async _formatCodeOnSaveInTextEditor(e){const t=[...this._onSaveProviders.getAllProvidersForEditor(e)];if(t.length>0){return(await this._reportBusy(e,Promise.all(t.map((t=>t.formatOnSave(e)))),!1)).filter((e=>e.length>0)).flat()}return function(e){return atom.config.get("atom-ide-code-format.formatOnSave",{scope:e.getRootScopeDescriptor()})}(e)?this._formatCodeInTextEditor(e,e.getBuffer().getRange()):[]}_reportBusy(e,t,r=!0){const n=this._busySignalService;if(void 0!==n){const o=e.getPath(),i=void 0!==o?Mt.basename(o):"";return n.reportBusyWhile(`Formatting code in ${i}`,(()=>t),{revealTooltip:r})}return t}addRangeProvider(e){return this._rangeProviders.addProvider(e)}addFileProvider(e){return this._fileProviders.addProvider(e)}addOnTypeProvider(e){return this._onTypeProviders.addProvider(e)}addOnSaveProvider(e){return this._onSaveProviders.addProvider(e)}consumeBusySignal(t){return this._busySignalService=t,new e.Disposable((()=>{this._busySignalService=void 0}))}dispose(){this._subscriptions.dispose()}}var Lt={formatOnSave:{title:"Format on Save",type:"boolean",default:!0,description:"Automatically format code upon saving for supported languages."},formatOnType:{title:"Format on Type",type:"boolean",default:!0,description:"Automatically format code as you type it for supported languages."}};let Nt;function Bt(e){return Nt.addRangeProvider(e)}function Wt(e){return Nt.addFileProvider(e)}function qt(e){return Nt.addOnTypeProvider(e)}function Ht(e){return Nt.addOnSaveProvider(e)}exports.activate=function(){Nt=new Dt},exports.config=Lt,exports.consumeBusySignal=function(e){return Nt.consumeBusySignal(e)},exports.consumeFileProvider=Wt,exports.consumeLegacyProvider=function(e){if(e.grammarScopes=e.grammarScopes||(null!=e.selector?e.selector.split(", "):null),e.priority=null!=e.priority?e.priority:null!=e.inclusionPriority?e.inclusionPriority:0,"formatCode"in e)return Bt(e);if("formatEntireFile"in e)return Wt(e);if("formatAtPosition"in e)return qt(e);if("formatOnSave"in e)return Ht(e);throw new Error("Invalid code format provider")},exports.consumeOnSaveProvider=Ht,exports.consumeOnTypeProvider=qt,exports.consumeRangeProvider=Bt,exports.deactivate=function(){Nt.dispose()}; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("atom"),t=require("log4js"),r=require("assert"),n=require("rxjs-compat/bundles/rxjs-compat.umd.min.js"),o=require("path"),i=require("os");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(e),u=s(t),l=s(r),c=s(n),f=s(o),d=s(i);var p={};Object.defineProperty(p,"__esModule",{value:!0});var h=p.ProviderRegistry=void 0;const m=a.default;h=p.ProviderRegistry=class{constructor(){this.providers=[]}addProvider(e){const t=this.providers.findIndex((t=>e.priority>t.priority));return-1===t?this.providers.push(e):this.providers.splice(t,0,e),new m.Disposable((()=>{this.removeProvider(e)}))}removeProvider(e){const t=this.providers.indexOf(e);-1!==t&&this.providers.splice(t,1)}getProviderForEditor(e){const t=e.getGrammar().scopeName;return this.findProvider(t)}getAllProvidersForEditor(e){const t=e.getGrammar().scopeName;return this.findAllProviders(t)}findProvider(e){for(const t of this.findAllProviders(e))return t;return null}*findAllProviders(e){for(const t of this.providers)null!=t.grammarScopes&&-1===t.grammarScopes.indexOf(e)||(yield t)}};var g={},v={},y={},_={};Object.defineProperty(_,"__esModule",{value:!0}),_.default=void 0;class w{constructor(...e){this.disposed=void 0,this.teardowns=void 0,this.teardowns=new Set,this.disposed=!1,e.length&&this.add(...e)}add(...e){if(this.disposed)throw new Error("Cannot add to an already disposed UniversalDisposable!");for(let t=0;t{r.dispose(),this.remove(r)})));this.add(r)}remove(e){this.disposed||this.teardowns.delete(e)}dispose(){this.disposed||(this.disposed=!0,this.teardowns.forEach((e=>{"function"==typeof e.dispose?e.dispose():"function"==typeof e.unsubscribe?e.unsubscribe():"function"==typeof e.destroy?e.destroy():"function"==typeof e&&e()})),this.teardowns=null)}unsubscribe(){this.dispose()}clear(){this.disposed||this.teardowns.clear()}}function b(e){if("function"!=typeof e.dispose&&"function"!=typeof e.unsubscribe&&"function"!=typeof e.destroy&&"function"!=typeof e)throw new TypeError("Arguments to UniversalDisposable.add must be disposable")}_.default=w,Object.defineProperty(y,"__esModule",{value:!0}),y.attachEvent=function(e,t,r){return e.addListener(t,r),new x.default((()=>{e.removeListener(t,r)}))},y.observableFromSubscribeFunction=function(e){return E.Observable.create((t=>new x.default(e(t.next.bind(t)))))};var P,x=(P=_)&&P.__esModule?P:{default:P},E=c.default;Object.defineProperty(v,"__esModule",{value:!0}),v.existingEditorForUri=function(e){for(const t of atom.workspace.getTextEditors())if(t.getPath()===e)return t;return null},v.existingEditorForBuffer=function(e){for(const t of atom.workspace.getTextEditors())if(t.getBuffer()===e)return t;return null},v.getViewOfEditor=R,v.getScrollTop=function(e){return R(e).getScrollTop()},v.setScrollTop=A,v.setPositionAndScroll=function(e,t,r){e.setCursorBufferPosition(t,{autoscroll:!1}),A(e,r)},v.getCursorPositions=function(e){return O.Observable.defer((()=>{const t=e.getCursors()[0];return(0,T.default)(null!=t),O.Observable.merge(O.Observable.of(t.getBufferPosition()),(0,C.observableFromSubscribeFunction)(t.onDidChangePosition.bind(t)).map((e=>e.newBufferPosition)))}))},v.observeEditorDestroy=function(e){return(0,C.observableFromSubscribeFunction)(e.onDidDestroy.bind(e)).map((t=>e)).take(1)},v.enforceReadOnlyEditor=function(e,t=["append","setText"]){return e.getElement().setAttribute("readonly",""),{dispose(){e.getElement().removeAttribute("readonly")}}},v.enforceSoftWrap=function(e,t){return e.setSoftWrapped(t),e.onDidChangeSoftWrapped((r=>{r!==t&&process.nextTick((()=>{e.isDestroyed()||e.setSoftWrapped(t)}))}))},v.isValidTextEditor=function(e){return e instanceof S.TextEditor},v.centerScrollToBufferLine=function(e,t){const r=e.getModel(),n=e.pixelPositionForBufferPosition([t,0]).top+r.getLineHeightInPixels()/2-e.clientHeight/2;e.setScrollTop(Math.max(n,1)),e.focus(),r.setCursorBufferPosition([t,0],{autoscroll:!1})};var T=function(e){return e&&e.__esModule?e:{default:e}}(l.default),S=a.default,O=c.default,C=y;function R(e){return atom.views.getView(e)}function A(e,t){R(e).setScrollTop(t)}var U={};Object.defineProperty(U,"__esModule",{value:!0}),U.goToLocation=async function(e,t){var r,n,o;const i=null===(r=null==t?void 0:t.center)||void 0===r||r,s=null===(n=null==t?void 0:t.moveCursor)||void 0===n||n,a=null===(o=null==t?void 0:t.activatePane)||void 0===o||o,u=null==t?void 0:t.activateItem,l=null==t?void 0:t.line,c=null==t?void 0:t.column,f=null==t?void 0:t.pending,d=atom.workspace.getActiveTextEditor();if(null!=d&&d.getPath()===e){const e=atom.workspace.paneContainerForItem(d);return(0,j.default)(null!=e),a&&e.activate(),null!=l?L(d,{line:l,column:null==c?0:c,center:i,moveCursor:s}):(0,j.default)(null==c,"goToLocation: Cannot specify just column"),d}{const t=await atom.workspace.open(e,{initialLine:l,initialColumn:c,searchAllPanes:!0,activatePane:a,activateItem:u,pending:f});if(null==t){const t={};Error.captureStackTrace(t);const r=Error(`atom.workspace.open returned null on ${e}`);throw(0,$.getLogger)("goToLocation").error(r),r}return i&&null!=l&&t.scrollToBufferPosition([l,c],{center:!0}),t}},U.goToLocationInEditor=L,U.observeNavigatingEditors=function(){return F};var $=u.default,I=c.default,j=function(e){return e&&e.__esModule?e:{default:e}}(l.default);const F=new I.Subject;function L(e,t){const r=null==t.center||t.center,n=null==t.moveCursor||t.moveCursor,{line:o,column:i}=t;n&&e.setCursorBufferPosition([o,i]),r&&e.scrollToBufferPosition([o,i],{center:!0}),F.next(e)}Object.defineProperty(g,"__esModule",{value:!0}),g.applyTextEditsForMultipleFiles=async function(e){const t=Array.from(e.keys()),r=(await Promise.all(t.map((async e=>(0,M.goToLocation)(e))))).map((e=>{(0,D.default)(null!=e);const t=e.getBuffer();return[t,t.createCheckpoint()]})),n=t.reduce(((t,r)=>{const n=e.get(r);return t&&null!=n&&q(r,...n)}),!0);n||r.forEach((([e,t])=>(e.revertToCheckpoint(t),!1)));return n},g.applyTextEdits=q;var B=g.applyTextEditsToBuffer=function(e,t){return N(e,z(t))},D=function(e){return e&&e.__esModule?e:{default:e}}(l.default),k=u.default,W=v,M=U;function q(e,...t){const r=z(t),n=(0,W.existingEditorForUri)(e);return(0,D.default)(null!=n),N(n.getBuffer(),r)}function N(e,t){if(function(e){for(let t=0;t=0;n--){if(!H(e,t[n]))return e.revertToCheckpoint(r),!1}return e.groupChangesSinceCheckpoint(r),!0}function H(e,t){if(t.oldRange.start.row===t.oldRange.end.row){const r=e.lineLengthForRow(t.oldRange.start.row);if(t.oldRange.end.column>r)return!1}if(null!=t.oldText){if(e.getTextInRange(t.oldRange)!==t.oldText)return!1}return e.setTextInRange(t.oldRange,t.newText),!0}function z(e){return e.map(((e,t)=>[e,t])).sort((([e,t],[r,n])=>e.oldRange.start.compare(r.oldRange.start)||e.oldRange.end.compare(r.oldRange.end)||t-n)).map((([e])=>e))}var V,G,J={},X={exports:{}};V=X,void 0!==(G=function(e,t){function r(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}function n(e){return encodeURIComponent(e).replace(/[!'()*]/g,r)}function o(e){return e.replace(/[#?]/,r)}Object.defineProperty(t,"__esModule",{value:!0});var i,s=function(){function e(){this._scheme=e._empty,this._authority=e._empty,this._path=e._empty,this._query=e._empty,this._fragment=e._empty,this._formatted=null,this._fsPath=null}return e.isUri=function(t){return t instanceof e||!!t&&"string"==typeof t.authority&&"string"==typeof t.fragment&&"string"==typeof t.path&&"string"==typeof t.query&&"string"==typeof t.scheme},Object.defineProperty(e.prototype,"scheme",{get:function(){return this._scheme},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authority",{get:function(){return this._authority},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._path},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fragment",{get:function(){return this._fragment},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fsPath",{get:function(){var t;return this._fsPath||(t=this._authority&&this._path&&"file"===this.scheme?"//"+this._authority+this._path:e._driveLetterPath.test(this._path)?this._path[1].toLowerCase()+this._path.substr(2):this._path,i&&(t=t.replace(/\//g,"\\")),this._fsPath=t),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.with=function(t){if(!t)return this;var r=t.scheme,n=t.authority,o=t.path,i=t.query,s=t.fragment;if(void 0===r?r=this.scheme:null===r&&(r=""),void 0===n?n=this.authority:null===n&&(n=""),void 0===o?o=this.path:null===o&&(o=""),void 0===i?i=this.query:null===i&&(i=""),void 0===s?s=this.fragment:null===s&&(s=""),r===this.scheme&&n===this.authority&&o===this.path&&i===this.query&&s===this.fragment)return this;var a=new e;return a._scheme=r,a._authority=n,a._path=o,a._query=i,a._fragment=s,e._validate(a),a},e.parse=function(t){var r=new e,n=e._parseComponents(t);return r._scheme=n.scheme,r._authority=decodeURIComponent(n.authority),r._path=decodeURIComponent(n.path),r._query=decodeURIComponent(n.query),r._fragment=decodeURIComponent(n.fragment),e._validate(r),r},e.file=function(t){var r=new e;if(r._scheme="file",i&&(t=t.replace(/\\/g,e._slash)),t[0]===e._slash&&t[0]===t[1]){var n=t.indexOf(e._slash,2);-1===n?r._authority=t.substring(2):(r._authority=t.substring(2,n),r._path=t.substring(n))}else r._path=t;return r._path[0]!==e._slash&&(r._path=e._slash+r._path),e._validate(r),r},e._parseComponents=function(t){var r={scheme:e._empty,authority:e._empty,path:e._empty,query:e._empty,fragment:e._empty},n=e._regexp.exec(t);return n&&(r.scheme=n[2]||r.scheme,r.authority=n[4]||r.authority,r.path=n[5]||r.path,r.query=n[7]||r.query,r.fragment=n[9]||r.fragment),r},e.from=function(t){return(new e).with(t)},e._validate=function(t){if(t.scheme&&!e._schemePattern.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!e._singleSlashStart.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(e._doubleSlashStart.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')},e.prototype.toString=function(t){return void 0===t&&(t=!1),t?e._asFormatted(this,!0):(this._formatted||(this._formatted=e._asFormatted(this,!1)),this._formatted)},e._asFormatted=function(t,r){var i=r?o:n,s=[],a=t.scheme,u=t.authority,l=t.path,c=t.query,f=t.fragment;if(a&&s.push(a,":"),(u||"file"===a)&&s.push("//"),u&&(-1===(h=(u=u.toLowerCase()).indexOf(":"))?s.push(i(u)):s.push(i(u.substr(0,h)),u.substr(h))),l){var d=e._upperCaseDrive.exec(l);d&&(l=d[1]?"/"+d[2].toLowerCase()+l.substr(3):d[2].toLowerCase()+l.substr(2));for(var p=0;;){var h;if(-1===(h=l.indexOf(e._slash,p))){s.push(i(l.substring(p)));break}s.push(i(l.substring(p,h)),e._slash),p=h+1}}return c&&s.push("?",i(c)),f&&s.push("#",i(f)),s.join(e._empty)},e.prototype.toJSON=function(){var e={fsPath:this.fsPath,external:this.toString(),$mid:1};return this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e},e.revive=function(t){var r=new e;return r._scheme=t.scheme||e._empty,r._authority=t.authority||e._empty,r._path=t.path||e._empty,r._query=t.query||e._empty,r._fragment=t.fragment||e._empty,r._fsPath=t.fsPath,r._formatted=t.external,e._validate(r),r},e}();if(s._empty="",s._slash="/",s._regexp=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,s._driveLetterPath=/^\/[a-zA-z]:/,s._upperCaseDrive=/^(\/)?([A-Z]:)/,s._schemePattern=/^\w[\w\d+.-]*$/,s._singleSlashStart=/^\//,s._doubleSlashStart=/^\/\//,t.default=s,"object"==typeof process)i="win32"===process.platform;else if("object"==typeof navigator){var a=navigator.userAgent;i=a.indexOf("Windows")>=0}}(0,X.exports))&&(V.exports=G);for(var Z={},K={quote:function(e){return e.map((function(e){return e&&"object"==typeof e?e.op.replace(/(.)/g,"\\$1"):/["\s]/.test(e)&&!/'/.test(e)?"'"+e.replace(/(['\\])/g,"\\$1")+"'":/["'\s]/.test(e)?'"'+e.replace(/(["\\$`!])/g,"\\$1")+'"':String(e).replace(/([#!"$&'()*,:;<=>?@\[\\\]^`{|}])/g,"\\$1")})).join(" ")}},Q="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","[&;()|<>]"].join("|")+")",Y="(\\\\['\"|&;()<> \\t]|[^\\s'\"|&;()<> \\t])+",ee="",te=0;te<4;te++)ee+=(Math.pow(16,8)*Math.random()).toString(16);K.parse=function(e,t,r){var n=function(e,t,r){var n=new RegExp(["("+Q+")","("+Y+"|\"((\\\\\"|[^\"])*?)\"|'((\\\\'|[^'])*?)')*"].join("|"),"g"),o=e.match(n).filter(Boolean),i=!1;if(!o)return[];t||(t={});r||(r={});return o.map((function(e,t){if(!i){if("#"===e.charAt(0))return i=!0,{comment:e.substr(1)+o.slice(t+1).join(" ")};if(RegExp("^"+Q+"$").test(e))return{op:e};for(var n="'",a='"',u="$",l=r.escape||"\\",c=!1,f=!1,d="",p=!1,h=0,m=e.length;h/g,">")},Z.ZERO_WIDTH_SPACE=Z.ELLIPSIS_CHAR=Z.URL_REGEX=void 0;var re=function(e){return e&&e.__esModule?e:{default:e}}(l.default),ne=K;const oe=36e5,ie=24*oe,se=7*ie,ae=365*ie,ue=ae/12,le=[[42e3,"now"],[9e4,"1m"],[36e5,"m",6e4],[54e5,"1h"],[ie,"h",oe],[2*ie,"1d"],[7*ie,"d",ie],[1.5*se,"1w"],[ue,"w",se],[1.5*ue,"1mo"],[ae,"mo",ue],[1.5*ae,"1y"],[Number.MAX_VALUE,"y",ae]],ce=[[42e3,"just now"],[9e4,"a minute ago"],[36e5,"minutes ago",6e4],[54e5,"an hour ago"],[ie,"hours ago",oe],[2*ie,"yesterday"],[7*ie,"days ago",ie],[1.5*se,"a week ago"],[ue,"weeks ago",se],[1.5*ue,"a month ago"],[ae,"months ago",ue],[1.5*ae,"a year ago"],[Number.MAX_VALUE,"years ago",ae]],fe=[[42e3,"just now"],[9e4,"1 minute ago"],[36e5,"minutes ago",6e4],[54e5,"1 hour ago"],[ie,"hours ago",oe],[2*ie,"yesterday"],[7*ie,"days ago",ie],[1.5*se,"1 week ago"],[ue,"weeks ago",se],[1.5*ue,"1 month ago"],[ae,"months ago",ue],[1.5*ae,"1 year ago"],[Number.MAX_VALUE,"years ago",ae]];Z.URL_REGEX=/(https?:\/\/(?:www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=!]*|www\.[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=!]*)/;Z.ELLIPSIS_CHAR="…";Z.ZERO_WIDTH_SPACE="​",Object.defineProperty(J,"__esModule",{value:!0}),J.__TEST__=Qe=J.default=void 0;var de=ve(X.exports),pe=ve(l.default),he=ve(f.default),me=ve(d.default),ge=Z;function ve(e){return e&&e.__esModule?e:{default:e}}const ye=[],_e=/^[A-Za-z0-9_-]+:\/\/.*/;function we(e){return e.startsWith("nuclide://")}function be(e){return e.startsWith("atom://")}function Pe(e,t){return(0,pe.default)(null!=t&&""!==t,"NuclideUri must include a path."),`nuclide://${e}${t}`}function xe(e){if(e.startsWith("nuclide://")){const t=e.substr("nuclide://".length),r=t.indexOf("/");(0,pe.default)(-1!==r,`Remote URIs must contain a hostname and a path. Failed to parse ${e}`);const n=t.substr(0,r);(0,pe.default)(""!==n,`Remote URIs must contain a hostname. Failed to parse ${e}`);const o=t.substr(r);return(0,pe.default)(!Ge(e),`Path cannot end with archive separator. Failed to parse ${e}`),{hostname:n,path:o}}return(0,pe.default)(!Ge(e),`Path cannot end with archive separator. Failed to parse ${e}`),{hostname:null,path:e}}function Ee(e){if(!we(e))throw new Error("Expected remote uri. Got "+e);const t=xe(e);return(0,pe.default)(t.hostname,`Remote Nuclide URIs must contain hostnames, '${(0,ge.maybeToString)(t.hostname)}' found while parsing '${e}'`),{hostname:t.hostname,path:t.path}}function Te(e){return xe(e).path}function Se(e){return Ee(e).hostname}function Oe(e,...t){return Ce(e,t)}function Ce(e,t){Xe(e);const r=qe(e);if(we(e)){const{hostname:n,path:o}=Ee(e);return t.splice(0,0,o),Ne(r,t),ze(r,Pe(n,r.join.apply(null,t)))}return t.splice(0,0,e),Ne(r,t),ze(r,r.join.apply(null,t))}function Re(e){Xe(e);const t=qe(e);if(we(e)){const{hostname:r,path:n}=Ee(e);return Pe(r,ze(t,t.normalize(He(t,n))))}return ze(t,t.normalize(He(t,e)))}function Ae(e,t=""){Xe(e);const r=qe(e);return ze(r,r.basename(He(r,Te(e)),t))}function Ue(e){Xe(e);const t=qe(e);if(we(e)){const{hostname:r,path:n}=Ee(e);return Pe(r,ze(t,t.dirname(He(t,n))))}return ze(t,t.dirname(He(t,e)))}function $e(e){Xe(e);const t=qe(e);return ze(t,t.extname(He(t,Te(e))))}function Ie(e){const t="file://";if(!e.startsWith(t))return null;const r=e.substr(t.length);return function(e){return qe(e)===he.default.win32}(r)?r:null}function je(e,t){if(Xe(e),Xe(t),t.length{const r=t(e);return null!=r&&""!==r?r:e}),e)}function Be(e){return Xe(e),we(e)?Le(Se(e)):e}function De(e){Xe(e);const t=qe(e);return e.endsWith(t.sep)?e:e+t.sep}function ke(e){Xe(e);const t=qe(e);return e.endsWith(t.sep)}function We(e){if(Xe(e),we(e))return!0;return qe(e).isAbsolute(e)}function Me(e){return Xe(e),Ue(e)===e}function qe(e){return(0,pe.default)(!Ge(e),`Path cannot end with archive separator. Failed to determine path module for ${e}`),e.startsWith(he.default.posix.sep)||e.indexOf("://")>-1?he.default.posix:":"===e[1]&&e[2]===he.default.win32.sep||e.split(he.default.win32.sep).length>e.split(he.default.posix.sep).length?he.default.win32:he.default.posix}function Ne(e,t){return t.forEach(((t,r,n)=>n[r]=He(e,t))),t}function He(e,t){return t.indexOf("!")<0?t:ye.reduce(((t,r)=>t.replace(`${r}!`,`${r}!${e.sep}`)),t)}function ze(e,t){return t.indexOf("!")<0?t:Ge(r=ye.reduce(((t,r)=>t.replace(`${r}!${e.sep}`,`${r}!`)),t))?r.substring(0,r.length-"!".length):r;var r}function Ve(e,t){return e.lengtht&&"!"===e.charAt(t)&&ye.some((r=>{const n=t-r.length;return e.indexOf(r,n)===n}))}function Xe(e){if(null!=e&&Ge(e))throw new Error(`Path operation invoked on URI ending with !: ${e}`)}const Ze=new Set([".bmp",".gif",".ico",".jpeg",".jpg",".png",".webp"]);var Ke={basename:Ae,dirname:Ue,extname:$e,stripExtension:function(e){Xe(e);const t=$e(e);return 0===t.length?e:e.slice(0,-1*t.length)},isRemote:we,isLocal:function(e){return!we(e)&&!function(e){return _e.test(e)}(e)&&!be(e)},createRemoteUri:Pe,isInArchive:function(e){if(be(e)||e.indexOf("!")<0)return!1;for(let t=e.indexOf("!");t>=0;t=e.indexOf("!",t+1))if(Je(e,t))return!0;return!1},ancestorOutsideArchive:function(e){for(let t=e.indexOf("!");t>=0;t=e.indexOf("!",t+1))if(Je(e,t))return e.substring(0,t);return e},parse:xe,parseRemoteUri:Ee,validate:function(e,t){(0,pe.default)(null!=e,"Unexpected null NuclideUri"),(0,pe.default)("string"==typeof e,`Unexpected NuclideUri type: ${String(e)}`),we(e)?(xe(e),(0,pe.default)(!1!==t,"Expected remote NuclideUri")):((0,pe.default)(""!==e,"NuclideUri must contain a non-empty path"),(0,pe.default)(!0!==t,"Expected local NuclideUri"))},getPath:Te,getHostname:Se,getHostnameOpt:function(e){return null!=e&&we(e)?Se(e):null},join:Oe,joinArray:Ce,archiveJoin:function(e,t){if(Xe(e),!ye.some((t=>e.endsWith(t))))throw new Error(`Cannot archiveJoin with non-archive ${e} and ${t}`);return e+"!"+t},relative:function(e,t){Xe(e);const r=qe(e),n=we(e);if(n!==we(t)||n&&Se(e)!==Se(t))throw new Error(`Cannot relative urls on different hosts: ${e} and ${t}`);const o=He(r,n?Te(e):e),i=He(r,n?Te(t):t);return ze(r,r.relative(Ve(o,i),Ve(i,o)))},looksLikeImageUri:function(e){const t=$e(e).toLowerCase();return Ze.has(t)},normalize:Re,normalizeDir:function(e){return De(Re(e))},getParent:function(e){return Re(Oe(e,".."))},uriToNuclideUri:function(e){const t=Ie(e);if(null!=t)return t;const r=de.default.parse(e);return"file"===r.scheme&&r.path?r.fsPath:we(e)?e:null},nuclideUriToUri:function(e){return Xe(e),we(e)?e:de.default.file(e).toString()},contains:je,collapse:function(e){return e.filter((t=>!e.some((e=>je(e,t)&&e!==t))))},nuclideUriToDisplayString:function(e){return Xe(e),we(e)?`${Be(e)}:${Te(e)}`:e},nuclideUriToDisplayHostname:Be,hostnameToDisplayHostname:Le,registerHostnameFormatter:function(e){return Fe.push(e),{dispose:()=>{const t=Fe.indexOf(e);t>=0&&Fe.splice(t,1)}}},ensureTrailingSeparator:De,trimTrailingSeparator:function(e){Xe(e);const t=qe(e);let r=e;for(;r.endsWith(t.sep)&&!Me(r);)r=r.slice(0,-1*t.sep.length);return r},endsWithSeparator:ke,endsWithEdenDir:function(e){return Xe(e),e.endsWith(".eden")},isAbsolute:We,isHomeRelative:function(e){return Xe(e),e.startsWith("~")},resolve:function(e,...t){Xe(e);const r=qe(e);if(we(e)){const{hostname:n,path:o}=Ee(e);return t.splice(0,0,o),Ne(r,t),Pe(n,ze(r,r.resolve.apply(null,t)))}return t.splice(0,0,e),Ne(r,t),ze(r,r.resolve.apply(null,t))},expandHomeDir:function(e){if(Xe(e),!e.startsWith("~"))return e;const{HOME:t,UserProfile:r}=process.env,n=!we(e)&&"win32"===me.default.platform(),o=n?r:t;return(0,pe.default)(null!=o),"~"===e?o:e.startsWith("~/")||n&&e.startsWith("~\\")?he.default.resolve(o,e.replace("~",".")):e},splitPathList:function(e){(0,pe.default)(e.indexOf("nuclide://")<0,"Splitting remote URIs is not supported");const t=qe(e);return e.split(t.delimiter)},joinPathList:function(e){if(0===e.length)return"";(0,pe.default)(e.every((e=>!we(e))),"Joining of remote URIs is not supported");const t=qe(e[0]);return e.join(t.delimiter)},ensureLocalPrefix:function(e){Xe(e);const t=qe(e);(0,pe.default)(!we(e),"Local prefix can not be added to a remote path"),(0,pe.default)(!We(e),"Local prefix can not be added to an absolute path");const r=`.${t.sep}`;return e.startsWith(r)?e:r+e},isRoot:Me,parsePath:function(e){Xe(e);const t=qe(e),r=t.parse(He(t,Te(e)));return{root:ze(t,r.root),dir:ze(t,r.dir),base:ze(t,r.base),ext:ze(t,r.ext),name:ze(t,r.name)}},split:function(e){const t=[];let r=e,n=Ue(r);for(;r!==n;)t.push(Ae(r)),r=n,n=Ue(r);return We(e)&&t.push(n),t.reverse(),t},pathSeparatorFor:function(e){return qe(e).sep},hasKnownArchiveExtension:function(e){return ye.some((t=>e.endsWith(t)))},ARCHIVE_SEPARATOR:"!",KNOWN_ARCHIVE_EXTENSIONS:ye,NUCLIDE_URI_TYPE_NAME:"NuclideUri"},Qe=J.default=Ke;const Ye={_pathModuleFor:qe};J.__TEST__=Ye;class et{constructor(){this._subscriptions=new e.CompositeDisposable(atom.commands.add("atom-text-editor","code-format:format-code",(async e=>{const t=e.currentTarget.getModel(),r=await this._formatCodeInTextEditor(t);try{if(!B(t.getBuffer(),r))throw new Error("No code formatting providers found!")}catch(e){atom.notifications.addError(`Failed to format code: ${e.message}`,{detail:e.detail})}})),atom.workspace.observeTextEditors((r=>{const n=new e.CompositeDisposable(r.getBuffer().onDidStopChanging((async e=>{if(atom.config.get("atom-ide-code-format.formatOnType"))try{await this._formatCodeOnTypeInTextEditor(r,e)}catch(e){t.getLogger("code-format").warn("Failed to format code on type:",e)}})),r.onDidSave(function(e,t){let r;return(...n)=>{void 0!==r&&clearTimeout(r),r=setTimeout((()=>{e(...n)}),t)}}((async()=>{const e=await this._formatCodeOnSaveInTextEditor(r);if(!B(r.getBuffer(),e))throw new Error("No code formatting providers found!")}),500)));r.onDidDestroy((()=>n.dispose()))}))),this._rangeProviders=new h,this._fileProviders=new h,this._onTypeProviders=new h,this._onSaveProviders=new h}async _formatCodeInTextEditor(t,r=t.getSelectedBufferRange()){const n=t.getBuffer().getRange();let o;if(r.isEmpty())o=n;else{const{start:t,end:n}=r;o=new e.Range([t.row,0],0===n.column?n:[n.row+1,0])}const i=[...this._rangeProviders.getAllProvidersForEditor(t)],s=(await this._reportBusy(t,Promise.all(i.map((e=>e.formatCode(t,o)))))).filter((e=>e.length>0)),a=[...this._fileProviders.getAllProvidersForEditor(t)],u=(await this._reportBusy(t,Promise.all(a.map((e=>e.formatEntireFile(t,o)))))).filter((e=>null!=e)),l=t.getText(),c=t.getBuffer().getRange(),f=u.map((({formatted:e})=>[{oldRange:c,newText:e,oldText:l}]));return(o.isEqual(n)?f.concat(s):s.concat(f)).flat()}async _formatCodeOnTypeInTextEditor(e,{changes:t}){if(1!==t.length)return[];const r=[...this._onTypeProviders.getAllProvidersForEditor(e)];if(0===r.length)return[];const n=t[0];if(!function(e){if(""!==e.oldText)return!1;if(""===e.newText)return!1;if(e.newText.length>1&&!function(e){if(void 0===atom.packages.getActivePackage("bracket-matcher"))return!1;return atom.config.get("bracket-matcher.autocompleteCharacters").includes(e)}(e.newText))return!1;return!0}(n))return[];const o=n.newText[n.newText.length-1],i=e.getText(),s=e.getCursorBufferPosition().copy(),a=await Promise.all(r.map((t=>t.formatAtPosition(e,e.getCursorBufferPosition(),o)))),u=a.findIndex((e=>e.length>0));if(-1===u)return[];{const t=a[u],n=r[u];if(function(e,t){if(e!==t)throw new Error("The file contents were changed before formatting was complete.")}(i,e.getText()),!B(e.getBuffer(),t))throw new Error("Could not apply edits to text buffer.");return n.keepCursorPosition&&e.setCursorBufferPosition(s),t}}async _formatCodeOnSaveInTextEditor(e){const t=[...this._onSaveProviders.getAllProvidersForEditor(e)];if(t.length>0){return(await this._reportBusy(e,Promise.all(t.map((t=>t.formatOnSave(e)))),!1)).filter((e=>e.length>0)).flat()}return function(e){return atom.config.get("atom-ide-code-format.formatOnSave",{scope:e.getRootScopeDescriptor()})}(e)?this._formatCodeInTextEditor(e,e.getBuffer().getRange()):[]}_reportBusy(e,t,r=!0){const n=this._busySignalService;if(void 0!==n){const o=e.getPath(),i=void 0!==o?Qe.basename(o):"";return n.reportBusyWhile(`Formatting code in ${i}`,(()=>t),{revealTooltip:r})}return t}addRangeProvider(e){return this._rangeProviders.addProvider(e)}addFileProvider(e){return this._fileProviders.addProvider(e)}addOnTypeProvider(e){return this._onTypeProviders.addProvider(e)}addOnSaveProvider(e){return this._onSaveProviders.addProvider(e)}consumeBusySignal(t){return this._busySignalService=t,new e.Disposable((()=>{this._busySignalService=void 0}))}dispose(){this._subscriptions.dispose()}}var tt={formatOnSave:{title:"Format on Save",type:"boolean",default:!0,description:"Automatically format code upon saving for supported languages."},formatOnType:{title:"Format on Type",type:"boolean",default:!1,description:"Automatically format code as you type it for supported languages."}};let rt;function nt(e){return rt.addRangeProvider(e)}function ot(e){return rt.addFileProvider(e)}function it(e){return rt.addOnTypeProvider(e)}function st(e){return rt.addOnSaveProvider(e)}exports.activate=function(){rt=new et},exports.config=tt,exports.consumeBusySignal=function(e){return rt.consumeBusySignal(e)},exports.consumeFileProvider=ot,exports.consumeLegacyProvider=function(e){if(e.grammarScopes=e.grammarScopes||(null!=e.selector?e.selector.split(", "):null),e.priority=null!=e.priority?e.priority:null!=e.inclusionPriority?e.inclusionPriority:0,"formatCode"in e)return nt(e);if("formatEntireFile"in e)return ot(e);if("formatAtPosition"in e)return it(e);if("formatOnSave"in e)return st(e);throw new Error("Invalid code format provider")},exports.consumeOnSaveProvider=st,exports.consumeOnTypeProvider=it,exports.consumeRangeProvider=nt,exports.deactivate=function(){rt.dispose()}; //# sourceMappingURL=main.js.map diff --git a/dist/main.js.map b/dist/main.js.map index bc0e8dd..fcd175a 100644 --- a/dist/main.js.map +++ b/dist/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sources":["../node_modules/nuclide/nuclide-commons/getDisplayName.js","../node_modules/nuclide/nuclide-commons/UniversalDisposable.js","../node_modules/nuclide/nuclide-commons/promise.js","../node_modules/nuclide/nuclide-commons/performanceNow.js","../node_modules/nuclide/nuclide-commons/analytics.js","../node_modules/nuclide/nuclide-commons-atom/ProviderRegistry.js","../node_modules/nuclide/nuclide-commons/event.js","../node_modules/nuclide/nuclide-commons-atom/text-editor.js","../node_modules/nuclide/nuclide-commons-atom/go-to-location.js","../node_modules/nuclide/nuclide-commons-atom/text-edit.js","../node_modules/nuclide/nuclide-commons-atom/FileEventHandlers.js","../node_modules/atom-ide-base/src-commons-atom/ProviderRegistry.ts","../node_modules/vscode-uri/lib/index.js","../node_modules/nuclide/nuclide-commons/_shell-quote.js","../node_modules/nuclide/nuclide-commons/string.js","../node_modules/nuclide/nuclide-commons/nuclideUri.js","../../src/CodeFormatManager.ts","../../src/config.ts","../../src/main.ts","../../src/legacy-provider.ts"],"sourcesContent":["/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nexport default function getDisplayName(\r\n functionOrClass: Function | Class<*>,\r\n): string {\r\n if (\r\n typeof functionOrClass.displayName === 'string' &&\r\n functionOrClass.displayName !== ''\r\n ) {\r\n return functionOrClass.displayName;\r\n } else if (\r\n typeof functionOrClass.name === 'string' &&\r\n functionOrClass.name !== ''\r\n ) {\r\n return functionOrClass.name;\r\n }\r\n\r\n return 'Unknown';\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nexport type IDestructible = {\r\n destroy(): void,\r\n onDidDestroy(callback: () => mixed): IDisposable,\r\n};\r\n\r\nexport type AnyTeardown =\r\n | (() => mixed)\r\n | rxjs$ISubscription\r\n | IDisposable\r\n | IDestructible;\r\n\r\n/**\r\n * Like a CompositeDisposable, but in addition to Disposable instances it can\r\n * also accept plain functions and Rx subscriptions.\r\n */\r\nexport default class UniversalDisposable {\r\n disposed: boolean;\r\n teardowns: Set;\r\n\r\n constructor(...teardowns: Array) {\r\n this.teardowns = new Set();\r\n this.disposed = false;\r\n if (teardowns.length) {\r\n this.add(...teardowns);\r\n }\r\n }\r\n\r\n add(...teardowns: Array): void {\r\n if (this.disposed) {\r\n throw new Error('Cannot add to an already disposed UniversalDisposable!');\r\n }\r\n for (let i = 0; i < teardowns.length; i++) {\r\n assertTeardown(teardowns[i]);\r\n this.teardowns.add(teardowns[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a list of teardowns but also ties them to the lifetime of `destructible`.\r\n * When `destructible` is destroyed (or `this.dispose()` gets called, whichever comes first),\r\n * all `teardowns` provided are also disposed.\r\n *\r\n * This is a subtle pattern to get right because of two factors:\r\n * - we need to make sure that all teardowns are also removed on destroy\r\n * - we also need to ensure that we don't leak the onDidDestroy disposable\r\n */\r\n addUntilDestroyed(\r\n destructible: IDestructible,\r\n ...teardowns: Array\r\n ) {\r\n if (this.disposed) {\r\n throw new Error('Cannot add to an already disposed UniversalDisposable!');\r\n }\r\n const destroyDisposable = new UniversalDisposable(\r\n ...teardowns,\r\n destructible.onDidDestroy(() => {\r\n destroyDisposable.dispose();\r\n this.remove(destroyDisposable);\r\n }),\r\n );\r\n this.add(destroyDisposable);\r\n }\r\n\r\n remove(teardown: AnyTeardown): void {\r\n if (!this.disposed) {\r\n this.teardowns.delete(teardown);\r\n }\r\n }\r\n\r\n dispose(): void {\r\n if (!this.disposed) {\r\n this.disposed = true;\r\n this.teardowns.forEach(teardown => {\r\n if (typeof teardown.dispose === 'function') {\r\n teardown.dispose();\r\n } else if (typeof teardown.unsubscribe === 'function') {\r\n teardown.unsubscribe();\r\n } else if (typeof teardown.destroy === 'function') {\r\n teardown.destroy();\r\n } else if (typeof teardown === 'function') {\r\n teardown();\r\n }\r\n });\r\n this.teardowns = (null: any);\r\n }\r\n }\r\n\r\n unsubscribe(): void {\r\n this.dispose();\r\n }\r\n\r\n clear(): void {\r\n if (!this.disposed) {\r\n this.teardowns.clear();\r\n }\r\n }\r\n}\r\n\r\nfunction assertTeardown(teardown: AnyTeardown): void {\r\n if (\r\n typeof teardown.dispose === 'function' ||\r\n typeof teardown.unsubscribe === 'function' ||\r\n typeof teardown.destroy === 'function' ||\r\n typeof teardown === 'function'\r\n ) {\r\n return;\r\n }\r\n throw new TypeError(\r\n 'Arguments to UniversalDisposable.add must be disposable',\r\n );\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport invariant from 'assert';\r\n\r\ntype RunReturn =\r\n | {\r\n status: 'success',\r\n result: T,\r\n }\r\n | {\r\n status: 'outdated',\r\n };\r\n\r\n/**\r\n * Allows a caller to ensure that the results it receives from consecutive\r\n * promise resolutions are never outdated. Usage:\r\n *\r\n * var requestSerializer = new RequestSerializer();\r\n *\r\n * // in some later loop:\r\n *\r\n * // note that you do not await the async function here -- you must pass the\r\n * // promise it returns to `run`\r\n * var result = await requestSerializer.run(someAsyncFunction())\r\n *\r\n * if (result.status === 'success') {\r\n * ....\r\n * result.result\r\n * } else if (result.status === 'outdated') {\r\n * ....\r\n * }\r\n *\r\n * The contract is that the status is 'success' if and only if this was the most\r\n * recently dispatched call of 'run'. For example, if you call run(promise1) and\r\n * then run(promise2), and promise2 resolves first, the second callsite would\r\n * receive a 'success' status. If promise1 later resolved, the first callsite\r\n * would receive an 'outdated' status.\r\n */\r\nexport class RequestSerializer {\r\n _lastDispatchedOp: number;\r\n _lastFinishedOp: number;\r\n _latestPromise: Promise;\r\n _waitResolve: Function;\r\n\r\n constructor() {\r\n this._lastDispatchedOp = 0;\r\n this._lastFinishedOp = 0;\r\n this._latestPromise = new Promise((resolve, reject) => {\r\n this._waitResolve = resolve;\r\n });\r\n }\r\n\r\n async run(promise: Promise): Promise> {\r\n const thisOp = this._lastDispatchedOp + 1;\r\n this._lastDispatchedOp = thisOp;\r\n this._latestPromise = promise;\r\n this._waitResolve();\r\n const result = await promise;\r\n if (this._lastFinishedOp < thisOp) {\r\n this._lastFinishedOp = thisOp;\r\n return {\r\n status: 'success',\r\n result,\r\n };\r\n } else {\r\n return {\r\n status: 'outdated',\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Returns a Promise that resolves to the last result of `run`,\r\n * as soon as there are no more outstanding `run` calls.\r\n */\r\n async waitForLatestResult(): Promise {\r\n let lastPromise = null;\r\n let result: any = null;\r\n while (lastPromise !== this._latestPromise) {\r\n lastPromise = this._latestPromise;\r\n // Wait for the current last know promise to resolve, or a next run have started.\r\n // eslint-disable-next-line no-await-in-loop\r\n result = await new Promise((resolve, reject) => {\r\n this._waitResolve = resolve;\r\n this._latestPromise.then(resolve);\r\n });\r\n }\r\n return (result: T);\r\n }\r\n\r\n isRunInProgress(): boolean {\r\n return this._lastDispatchedOp > this._lastFinishedOp;\r\n }\r\n}\r\n\r\n/*\r\n * Returns a promise that will resolve after `milliSeconds` milli seconds.\r\n * this can be used to pause execution asynchronously.\r\n * e.g. await sleep(1000), pauses the async flow execution for 1 second.\r\n */\r\nexport function sleep(milliSeconds: number): Promise {\r\n return new Promise(resolve => {\r\n setTimeout(resolve, milliSeconds);\r\n });\r\n}\r\n\r\nexport function nextTick(): Promise {\r\n return new Promise(resolve => {\r\n process.nextTick(resolve);\r\n });\r\n}\r\n\r\n/**\r\n * Executes a provided callback only if a promise takes longer than\r\n * `milliSeconds` milliseconds to resolve.\r\n *\r\n * @param `promise` the promise to wait on.\r\n * @param `milliSeconds` max amount of time that `promise` can take to resolve\r\n * before timeoutFn is fired.\r\n * @param `timeoutFn` the function to execute when a promise takes longer than\r\n * `milliSeconds` ms to resolve.\r\n * @param `cleanupFn` the cleanup function to execute after the promise resolves.\r\n */\r\nexport async function triggerAfterWait(\r\n promise: Promise,\r\n milliSeconds: number,\r\n timeoutFn: () => void,\r\n cleanupFn?: () => void,\r\n): Promise {\r\n const timeout = setTimeout(timeoutFn, milliSeconds);\r\n try {\r\n return await promise;\r\n } finally {\r\n clearTimeout(timeout);\r\n if (cleanupFn) {\r\n cleanupFn();\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Thrown by `timeoutPromise` if the timer fires before the promise resolves/rejects.\r\n */\r\nexport class TimedOutError extends Error {\r\n timeout: number;\r\n constructor(milliseconds: number) {\r\n super(`Timed out after ${String(milliseconds)} ms`);\r\n this.timeout = milliseconds;\r\n }\r\n}\r\n\r\n/**\r\n * Returns a Promise that resolves to the same value as the given promise, or rejects with\r\n * `TimedOutError` if it takes longer than `milliseconds` milliseconds.\r\n */\r\nexport function timeoutPromise(\r\n promise: Promise,\r\n milliseconds: number,\r\n): Promise {\r\n return new Promise((resolve, reject) => {\r\n let timeout = setTimeout(() => {\r\n timeout = null;\r\n reject(new TimedOutError(milliseconds));\r\n // This gives useless error.stack results.\r\n // We could capture the stack pre-emptively at the start\r\n // of this method if we wanted useful ones.\r\n }, milliseconds);\r\n promise\r\n .then(value => {\r\n if (timeout != null) {\r\n clearTimeout(timeout);\r\n }\r\n resolve(value);\r\n })\r\n .catch(value => {\r\n if (timeout != null) {\r\n clearTimeout(timeout);\r\n }\r\n reject(value);\r\n });\r\n });\r\n}\r\n\r\n// An DeadlineRequest parameter to an async method is a way of *requesting* that\r\n// method to throw a TimedOutError if it doesn't complete in a certain time.\r\n// It's just a request -- the async method will typically honor the request\r\n// by passing the parameter on to ALL subsidiary async methods that it awaits,\r\n// or by calling expirePromise to enforce a timeout, or similar.\r\n//\r\n// In cases where a method supports DeadlineRequest but you don't trust it, do\r\n// `await timeoutAfterDeadline(deadline, untrusted.foo(deadline-1000))` so you\r\n// ask it nicely but if it doesn't give its own more-specific deadline message\r\n// within a 1000ms grace period then you force matters.\r\n//\r\n// Under the hood an DeadlineRequest is just a timestamp of the time by which\r\n// the operation should complete. This makes it compositional (better than\r\n// \"delay\" parameters) and safely remotable (better than \"CancellationToken\"\r\n// parameters) so long as clocks are in sync. In all other respects it's less\r\n// versatile than CancellationTokens.\r\nexport type DeadlineRequest = number;\r\n\r\nexport function createDeadline(delay: number): DeadlineRequest {\r\n return Date.now() + delay;\r\n}\r\n\r\nexport function timeoutAfterDeadline(\r\n deadline: DeadlineRequest,\r\n promise: Promise,\r\n): Promise {\r\n const delay = deadline - Date.now();\r\n return timeoutPromise(promise, delay < 0 ? 0 : delay);\r\n}\r\n\r\n/**\r\n * Call an async function repeatedly with a maximum number of trials limit,\r\n * until a valid result that's defined by a validation function.\r\n * A failed call can result from an async thrown exception, or invalid result.\r\n *\r\n * @param `retryFunction` the async logic that's wanted to be retried.\r\n * @param `validationFunction` the validation function that decides whether a response is valid.\r\n * @param `maximumTries` the number of times the `retryFunction` can fail to get a valid\r\n * response before the `retryLimit` is terminated reporting an error.\r\n * @param `retryIntervalMs` optional, the number of milliseconds to wait between trials, if wanted.\r\n *\r\n * If an exception is encountered on the last trial, the exception is thrown.\r\n * If no valid response is found, an exception is thrown.\r\n */\r\nexport async function retryLimit(\r\n retryFunction: () => Promise,\r\n validationFunction: (result: T) => boolean,\r\n maximumTries: number,\r\n retryIntervalMs?: number = 0,\r\n): Promise {\r\n let result = null;\r\n let tries = 0;\r\n let lastError = null;\r\n while (tries === 0 || tries < maximumTries) {\r\n try {\r\n // eslint-disable-next-line no-await-in-loop\r\n result = await retryFunction();\r\n lastError = null;\r\n if (validationFunction(result)) {\r\n return result;\r\n }\r\n } catch (error) {\r\n lastError = error;\r\n result = null;\r\n }\r\n\r\n if (++tries < maximumTries && retryIntervalMs !== 0) {\r\n // eslint-disable-next-line no-await-in-loop\r\n await sleep(retryIntervalMs);\r\n }\r\n }\r\n if (lastError != null) {\r\n throw lastError;\r\n } else if (tries === maximumTries) {\r\n throw new Error('No valid response found!');\r\n } else {\r\n return ((result: any): T);\r\n }\r\n}\r\n\r\n/**\r\n * Limits async function execution parallelism to only one at a time.\r\n * Hence, if a call is already running, it will wait for it to finish,\r\n * then start the next async execution, but if called again while not finished,\r\n * it will return the scheduled execution promise.\r\n *\r\n * Sample Usage:\r\n * ```\r\n * let i = 1;\r\n * const oneExecAtATime = oneParallelAsyncCall(() => {\r\n * return next Promise((resolve, reject) => {\r\n * setTimeout(200, () => resolve(i++));\r\n * });\r\n * });\r\n *\r\n * const result1Promise = oneExecAtATime(); // Start an async, and resolve to 1 in 200 ms.\r\n * const result2Promise = oneExecAtATime(); // Schedule the next async, and resolve to 2 in 400 ms.\r\n * const result3Promise = oneExecAtATime(); // Reuse scheduled promise and resolve to 2 in 400 ms.\r\n * ```\r\n */\r\nexport function serializeAsyncCall(\r\n asyncFun: () => Promise,\r\n): () => Promise {\r\n let scheduledCall = null;\r\n let pendingCall = null;\r\n const startAsyncCall = () => {\r\n const resultPromise = asyncFun();\r\n pendingCall = resultPromise.then(\r\n () => (pendingCall = null),\r\n () => (pendingCall = null),\r\n );\r\n return resultPromise;\r\n };\r\n const callNext = () => {\r\n scheduledCall = null;\r\n return startAsyncCall();\r\n };\r\n const scheduleNextCall = () => {\r\n if (scheduledCall == null) {\r\n invariant(pendingCall, 'pendingCall must not be null!');\r\n scheduledCall = pendingCall.then(callNext, callNext);\r\n }\r\n return scheduledCall;\r\n };\r\n return () => {\r\n if (pendingCall == null) {\r\n return startAsyncCall();\r\n } else {\r\n return scheduleNextCall();\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Provides a promise along with methods to change its state. Our version of the non-standard\r\n * `Promise.defer()`.\r\n *\r\n * IMPORTANT: This should almost never be used!! Instead, use the Promise constructor. See\r\n * \r\n */\r\nexport class Deferred {\r\n promise: Promise;\r\n resolve: (value: T) => void;\r\n reject: (error: Error) => void;\r\n\r\n constructor() {\r\n this.promise = new Promise((resolve, reject) => {\r\n this.resolve = resolve;\r\n this.reject = reject;\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Returns a value derived asynchronously from an element in the items array.\r\n * The test function is applied sequentially to each element in items until\r\n * one returns a Promise that resolves to a non-null value. When this happens,\r\n * the Promise returned by this method will resolve to that non-null value. If\r\n * no such Promise is produced, then the Promise returned by this function\r\n * will resolve to null.\r\n *\r\n * @param items Array of elements that will be passed to test, one at a time.\r\n * @param test Will be called with each item and must return either:\r\n * (1) A \"thenable\" (i.e, a Promise or promise-like object) that resolves\r\n * to a derived value (that will be returned) or null.\r\n * (2) null.\r\n * In both cases where null is returned, test will be applied to the next\r\n * item in the array.\r\n * @param thisArg Receiver that will be used when test is called.\r\n * @return Promise that resolves to an asynchronously derived value or null.\r\n */\r\nexport function asyncFind(\r\n items_: Array,\r\n test: (t: T) => ?Promise,\r\n thisArg?: mixed,\r\n): Promise {\r\n let items = items_;\r\n return new Promise((resolve, reject) => {\r\n // Create a local copy of items to defend against the caller modifying the\r\n // array before this Promise is resolved.\r\n items = items.slice();\r\n const numItems = items.length;\r\n\r\n const next = async function(index) {\r\n if (index === numItems) {\r\n resolve(null);\r\n return;\r\n }\r\n\r\n const item = items[index];\r\n const result = await test.call(thisArg, item);\r\n if (result != null) {\r\n resolve(result);\r\n } else {\r\n next(index + 1);\r\n }\r\n };\r\n\r\n next(0);\r\n });\r\n}\r\n\r\nexport function denodeify(\r\n f: (...args: Array) => any,\r\n): (...args: Array) => Promise {\r\n return function(...args: Array) {\r\n return new Promise((resolve, reject) => {\r\n function callback(error, result) {\r\n if (error) {\r\n reject(error);\r\n } else {\r\n resolve(result);\r\n }\r\n }\r\n f.apply(this, args.concat([callback]));\r\n });\r\n };\r\n}\r\n\r\n/**\r\n * A Promise utility that runs a maximum of limit async operations at a time\r\n * iterating over an array and returning the result of executions.\r\n * e.g. to limit the number of file reads to 5,\r\n * replace the code:\r\n * var fileContents = await Promise.all(filePaths.map(fsPromise.readFile))\r\n * with:\r\n * var fileContents = await asyncLimit(filePaths, 5, fsPromise.readFile)\r\n *\r\n * This is particulrily useful to limit IO operations to a configurable maximum (to avoid\r\n * blocking), while enjoying the configured level of parallelism.\r\n *\r\n * @param array the array of items for iteration.\r\n * @param limit the configurable number of parallel async operations.\r\n * @param mappingFunction the async Promise function that could return a useful result.\r\n */\r\nexport function asyncLimit(\r\n array: Array,\r\n limit: number,\r\n mappingFunction: (item: T) => Promise,\r\n): Promise> {\r\n const result: Array = new Array(array.length);\r\n let parallelPromises = 0;\r\n let index = 0;\r\n\r\n let parallelLimit = Math.min(limit, array.length) || 1;\r\n\r\n return new Promise((resolve, reject) => {\r\n const runPromise = async () => {\r\n if (index === array.length) {\r\n if (parallelPromises === 0) {\r\n resolve(result);\r\n }\r\n return;\r\n }\r\n ++parallelPromises;\r\n const i = index++;\r\n try {\r\n result[i] = await mappingFunction(array[i]);\r\n } catch (e) {\r\n reject(e);\r\n }\r\n --parallelPromises;\r\n runPromise();\r\n };\r\n\r\n while (parallelLimit--) {\r\n runPromise();\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * `filter` Promise utility that allows filtering an array with an async Promise function.\r\n * It's an alternative to `Array.prototype.filter` that accepts an async function.\r\n * You can optionally configure a limit to set the maximum number of async operations at a time.\r\n *\r\n * Previously, with the `Promise.all` primitive, we can't set the parallelism limit and we have to\r\n * `filter`, so, we replace the old `filter` code:\r\n * var existingFilePaths = [];\r\n * await Promise.all(filePaths.map(async (filePath) => {\r\n * if (await fsPromise.exists(filePath)) {\r\n * existingFilePaths.push(filePath);\r\n * }\r\n * }));\r\n * with limit 5 parallel filesystem operations at a time:\r\n * var existingFilePaths = await asyncFilter(filePaths, fsPromise.exists, 5);\r\n *\r\n * @param array the array of items for `filter`ing.\r\n * @param filterFunction the async `filter` function that returns a Promise that resolves to a\r\n * boolean.\r\n * @param limit the configurable number of parallel async operations.\r\n */\r\nexport async function asyncFilter(\r\n array: Array,\r\n filterFunction: (item: T) => Promise,\r\n limit?: number,\r\n): Promise> {\r\n const filteredList = [];\r\n // flowlint-next-line sketchy-null-number:off\r\n await asyncLimit(array, limit || array.length, async (item: T) => {\r\n if (await filterFunction(item)) {\r\n filteredList.push(item);\r\n }\r\n });\r\n return filteredList;\r\n}\r\n\r\nexport async function asyncObjFilter(\r\n obj: {[key: string]: T},\r\n filterFunction: (item: T, key: string) => Promise,\r\n limit?: number,\r\n): Promise<{[key: string]: T}> {\r\n const keys = Object.keys(obj);\r\n const filteredObj = {};\r\n // flowlint-next-line sketchy-null-number:off\r\n await asyncLimit(keys, limit || keys.length, async (key: string) => {\r\n const item = obj[key];\r\n if (await filterFunction(item, key)) {\r\n filteredObj[key] = item;\r\n }\r\n });\r\n return filteredObj;\r\n}\r\n\r\n/**\r\n * `some` Promise utility that allows `some` an array with an async Promise some function.\r\n * It's an alternative to `Array.prototype.some` that accepts an async some function.\r\n * You can optionally configure a limit to set the maximum number of async operations at a time.\r\n *\r\n * Previously, with the Promise.all primitive, we can't set the parallelism limit and we have to\r\n * `some`, so, we replace the old `some` code:\r\n * var someFileExist = false;\r\n * await Promise.all(filePaths.map(async (filePath) => {\r\n * if (await fsPromise.exists(filePath)) {\r\n * someFileExist = true;\r\n * }\r\n * }));\r\n * with limit 5 parallel filesystem operations at a time:\r\n * var someFileExist = await asyncSome(filePaths, fsPromise.exists, 5);\r\n *\r\n * @param array the array of items for `some`ing.\r\n * @param someFunction the async `some` function that returns a Promise that resolves to a\r\n * boolean.\r\n * @param limit the configurable number of parallel async operations.\r\n */\r\nexport async function asyncSome(\r\n array: Array,\r\n someFunction: (item: T) => Promise,\r\n limit?: number,\r\n): Promise {\r\n let resolved = false;\r\n // flowlint-next-line sketchy-null-number:off\r\n await asyncLimit(array, limit || array.length, async (item: T) => {\r\n if (resolved) {\r\n // We don't need to call the someFunction anymore or wait any longer.\r\n return;\r\n }\r\n if (await someFunction(item)) {\r\n resolved = true;\r\n }\r\n });\r\n return resolved;\r\n}\r\n\r\n/**\r\n * Check if an object is Promise by testing if it has a `then` function property.\r\n */\r\nexport function isPromise(object: any): boolean {\r\n return (\r\n Boolean(object) &&\r\n typeof object === 'object' &&\r\n typeof object.then === 'function'\r\n );\r\n}\r\n\r\n/**\r\n * We can't name a function 'finally', so use lastly instead.\r\n * fn() will be executed (and completed) after the provided promise resolves/rejects.\r\n */\r\nexport function lastly(\r\n promise: Promise,\r\n fn: () => Promise | mixed,\r\n): Promise {\r\n return promise.then(\r\n ret => {\r\n return Promise.resolve(fn()).then(() => ret);\r\n },\r\n err => {\r\n return Promise.resolve(fn()).then(() => Promise.reject(err));\r\n },\r\n );\r\n}\r\n\r\n/**\r\n * With a pure promise object, there's no way to tell synchronously\r\n * whether or not it has 'settled' (i.e. been fulfilled or rejected).\r\n * Here we provide a wrapper that provides that information.\r\n */\r\nexport type PromiseState =\r\n | {kind: 'pending'}\r\n | {kind: 'fulfilled', value: T}\r\n | {kind: 'rejected', error: any};\r\n\r\nexport class PromiseWithState {\r\n _promise: Promise;\r\n _state: PromiseState;\r\n\r\n constructor(promise: Promise) {\r\n this._state = {kind: 'pending'};\r\n this._promise = promise.then(\r\n value => {\r\n this._state = {kind: 'fulfilled', value};\r\n return value;\r\n },\r\n error => {\r\n this._state = {kind: 'rejected', error};\r\n throw error;\r\n },\r\n );\r\n }\r\n\r\n getPromise(): Promise {\r\n return this._promise;\r\n }\r\n\r\n getState(): PromiseState {\r\n return this._state;\r\n }\r\n}\r\n\r\nexport function delayTime(ms: number): Promise {\r\n return new Promise((resolve, reject) => {\r\n setTimeout(resolve, ms);\r\n });\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow strict\r\n * @format\r\n */\r\n\r\n/* global performance */\r\n\r\n/**\r\n * Polyfill for performance.now that works both on Atom (chrome) and node.\r\n * It returns a monotonically increasing timer in milliseconds.\r\n *\r\n * Usage:\r\n * const now = performanceNow();\r\n * // ... code you want to benchmark ...\r\n * const timeItTookInMilliseconds = performanceNow() - now;\r\n */\r\n\r\nexport default (typeof performance !== 'undefined'\r\n ? (): number => performance.now()\r\n : (): number => {\r\n const [seconds, nanoseconds] = process.hrtime();\r\n return seconds * 1000 + nanoseconds / 1000000;\r\n });\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport type {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\n\r\nimport getDisplayName from './getDisplayName';\r\nimport UniversalDisposable from './UniversalDisposable';\r\nimport {isPromise} from './promise';\r\nimport performanceNow from './performanceNow';\r\n\r\nexport type SessionInfo = {\r\n id: string,\r\n start: number,\r\n};\r\n\r\nexport type RawAnalyticsService = {\r\n track(\r\n eventName: string,\r\n values?: {[key: string]: mixed},\r\n immediate?: boolean,\r\n ): ?Promise,\r\n isTrackSupported: () => boolean,\r\n setApplicationSessionObservable: (Observable) => void,\r\n};\r\n\r\nlet rawAnalyticsService: RawAnalyticsService = {\r\n track(): ?Promise {},\r\n isTrackSupported: () => false,\r\n setApplicationSessionObservable: (ob: Observable) => {},\r\n};\r\n\r\nexport type TrackingEvent = {\r\n type: string,\r\n data?: Object,\r\n};\r\n\r\nexport type TrackEvent = {\r\n key: string,\r\n values: {[key: string]: mixed},\r\n};\r\n\r\n/**\r\n * Track a set of values against a named event.\r\n * Analytics will be batched and processed asynchronously in the background.\r\n *\r\n * @param eventName Name of the event to be tracked.\r\n * @param values The object containing the data to track.\r\n */\r\nexport function track(\r\n eventName: string,\r\n values?: {[key: string]: mixed},\r\n): void {\r\n rawAnalyticsService.track(eventName, values || {});\r\n}\r\n\r\nexport function isTrackSupported(): boolean {\r\n return rawAnalyticsService.isTrackSupported();\r\n}\r\n\r\n/**\r\n * Same as `track`, except this is guaranteed to send immediately.\r\n * The returned promise will resolve when the request completes (or reject on failure).\r\n */\r\nexport function trackImmediate(\r\n eventName: string,\r\n values?: {[key: string]: mixed},\r\n): Promise {\r\n return (\r\n rawAnalyticsService.track(eventName, values || {}, true) ||\r\n Promise.resolve()\r\n );\r\n}\r\n\r\n/**\r\n * An alternative interface for `track` that accepts a single event object. This is particularly\r\n * useful when dealing with streams (Observables).\r\n */\r\nexport function trackEvent(event: TrackingEvent): void {\r\n track(event.type, event.data);\r\n}\r\n\r\n/**\r\n * Track each event in a stream of TrackingEvents.\r\n */\r\nexport function trackEvents(events: Observable): IDisposable {\r\n return new UniversalDisposable(events.subscribe(trackEvent));\r\n}\r\n\r\n/**\r\n * A sampled version of track that only tracks every 1/sampleRate calls.\r\n */\r\nexport function trackSampled(\r\n eventName: string,\r\n sampleRate: number,\r\n values?: {[key: string]: mixed},\r\n): void {\r\n if (Math.random() * sampleRate <= 1) {\r\n rawAnalyticsService.track(eventName, {\r\n ...values,\r\n sample_rate: sampleRate,\r\n });\r\n }\r\n}\r\n\r\nconst PERFORMANCE_EVENT = 'performance';\r\nconst canMeasure = typeof performance !== 'undefined';\r\nexport class TimingTracker {\r\n static eventCount = 0;\r\n\r\n _eventName: string;\r\n _startTime: number;\r\n _startMark: string;\r\n _values: {[key: string]: mixed};\r\n\r\n constructor(eventName: string, values: {[key: string]: mixed}) {\r\n this._eventName = eventName;\r\n this._startMark = `${this._eventName}_${TimingTracker.eventCount++}_start`;\r\n this._startTime = performanceNow();\r\n this._values = values;\r\n if (canMeasure) {\r\n // eslint-disable-next-line no-undef\r\n performance.mark(this._startMark);\r\n }\r\n }\r\n\r\n onError(error: Error): void {\r\n this._trackTimingEvent(error);\r\n }\r\n\r\n onCancel(): void {\r\n this._trackTimingEvent(/* error */ null, true);\r\n }\r\n\r\n onSuccess(): void {\r\n this._trackTimingEvent(/* error */ null);\r\n }\r\n\r\n _trackTimingEvent(exception: ?Error, canceled: boolean = false): void {\r\n if (canMeasure) {\r\n /* eslint-disable no-undef */\r\n // call measure to add this information to the devtools timeline in the\r\n // case the profiler is running.\r\n performance.measure(this._eventName, this._startMark);\r\n // then clear all the marks and measurements to avoid growing the\r\n // performance entry buffer\r\n performance.clearMarks(this._startMark);\r\n performance.clearMeasures(this._eventName);\r\n /* eslint-enable no-undef */\r\n }\r\n\r\n track(PERFORMANCE_EVENT, {\r\n ...this._values,\r\n duration: Math.round(performanceNow() - this._startTime).toString(),\r\n eventName: this._eventName,\r\n error: exception ? '1' : '0',\r\n exception: exception ? exception.toString() : '',\r\n canceled,\r\n });\r\n }\r\n}\r\n\r\nexport function startTracking(\r\n eventName: string,\r\n values?: {[key: string]: any} = {},\r\n): TimingTracker {\r\n return new TimingTracker(eventName, values);\r\n}\r\n\r\n/**\r\n * Reports analytics including timing for a single operation.\r\n *\r\n * Usage:\r\n *\r\n * analytics.trackTiming('my-package-some-long-operation' () => doit());\r\n *\r\n * Returns (or throws) the result of the operation.\r\n */\r\nexport function trackTiming(\r\n eventName: string,\r\n operation: () => T,\r\n values?: {[key: string]: any} = {},\r\n): T {\r\n const tracker = startTracking(eventName, values);\r\n\r\n try {\r\n const result = operation();\r\n\r\n if (isPromise(result)) {\r\n // Atom uses a different Promise implementation than Nuclide, so the following is not true:\r\n // invariant(result instanceof Promise);\r\n\r\n // For the method returning a Promise, track the time after the promise is resolved/rejected.\r\n return (result: any).then(\r\n value => {\r\n tracker.onSuccess();\r\n return value;\r\n },\r\n reason => {\r\n tracker.onError(reason instanceof Error ? reason : new Error(reason));\r\n return Promise.reject(reason);\r\n },\r\n );\r\n } else {\r\n tracker.onSuccess();\r\n return result;\r\n }\r\n } catch (error) {\r\n tracker.onError(error);\r\n throw error;\r\n }\r\n}\r\n\r\nexport function decorateTrackTiming, T>(\r\n fn: (...args: U) => T,\r\n values?: {[key: string]: any} = {},\r\n): (...args: U) => T {\r\n const name = getDisplayName(fn);\r\n function decoratedTrackTiming(...args: U) {\r\n return trackTiming(name, fn.bind(this, ...args), values);\r\n }\r\n decoratedTrackTiming.displayName = `trackTiming(${name})`;\r\n return decoratedTrackTiming;\r\n}\r\n\r\n/**\r\n * A sampled version of trackTiming that only tracks every 1/sampleRate calls.\r\n */\r\nexport function trackTimingSampled(\r\n eventName: string,\r\n operation: () => T,\r\n sampleRate: number,\r\n values?: {[key: string]: any} = {},\r\n): T {\r\n if (Math.random() * sampleRate <= 1) {\r\n return trackTiming(eventName, operation, {\r\n ...values,\r\n sample_rate: sampleRate,\r\n });\r\n }\r\n return operation();\r\n}\r\n\r\nexport function decorateTrackTimingSampled, T>(\r\n fn: (...args: U) => T,\r\n sampleRate: number,\r\n values?: {[key: string]: any} = {},\r\n): (...args: U) => T {\r\n const name = getDisplayName(fn);\r\n function decoratedTrackTimingSampled(...args: U) {\r\n return trackTimingSampled(name, fn.bind(this, ...args), sampleRate, values);\r\n }\r\n decoratedTrackTimingSampled.displayName = `trackTimingSampled(${name})`;\r\n return decoratedTrackTimingSampled;\r\n}\r\n\r\nexport function setRawAnalyticsService(\r\n analyticsService: RawAnalyticsService,\r\n ob: Observable,\r\n): void {\r\n analyticsService.setApplicationSessionObservable(ob);\r\n rawAnalyticsService = analyticsService;\r\n}\r\n\r\nexport default {\r\n track,\r\n trackSampled,\r\n trackEvent,\r\n trackTiming,\r\n trackTimingSampled,\r\n startTracking,\r\n TimingTracker,\r\n decorateTrackTiming,\r\n decorateTrackTimingSampled,\r\n};\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport UniversalDisposable from '@atom-ide-community/nuclide-commons/UniversalDisposable';\r\n\r\nexport type Provider = {\r\n // Providers with higher priorities will be preferred over lower ones.\r\n priority: number,\r\n // Omitting grammarScopes implies that the provider applies to all grammars.\r\n +grammarScopes?: Array,\r\n};\r\n\r\nexport default class ProviderRegistry {\r\n _providers: Array;\r\n\r\n constructor() {\r\n this._providers = [];\r\n }\r\n\r\n addProvider(provider: T): IDisposable {\r\n const index = this._providers.findIndex(\r\n p => provider.priority > p.priority,\r\n );\r\n if (index === -1) {\r\n this._providers.push(provider);\r\n } else {\r\n this._providers.splice(index, 0, provider);\r\n }\r\n return new UniversalDisposable(() => {\r\n this.removeProvider(provider);\r\n });\r\n }\r\n\r\n removeProvider(provider: T): void {\r\n const index = this._providers.indexOf(provider);\r\n if (index !== -1) {\r\n this._providers.splice(index, 1);\r\n }\r\n }\r\n\r\n // TODO deprecate since there can be N providers.\r\n getProviderForEditor(editor: atom$TextEditor): ?T {\r\n const grammar = editor.getGrammar().scopeName;\r\n return this.findProvider(grammar);\r\n }\r\n\r\n // TODO create an ordering or priority aware util to prefer instead.\r\n getAllProvidersForEditor(editor: atom$TextEditor): Iterable {\r\n const grammar = editor.getGrammar().scopeName;\r\n return this.findAllProviders(grammar);\r\n }\r\n\r\n findProvider(grammar: string): ?T {\r\n for (const provider of this.findAllProviders(grammar)) {\r\n return provider;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Iterates over all providers matching the grammar, in priority order.\r\n */\r\n *findAllProviders(grammar: string): Iterable {\r\n for (const provider of this._providers) {\r\n if (\r\n provider.grammarScopes == null ||\r\n provider.grammarScopes.indexOf(grammar) !== -1\r\n ) {\r\n yield provider;\r\n }\r\n }\r\n }\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport UniversalDisposable from './UniversalDisposable';\r\nimport {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\n\r\n/**\r\n * Add an event listener an return a disposable for removing it. Note that this function assumes\r\n * node EventEmitter semantics: namely, that adding the same combination of eventName and callback\r\n * adds a second listener.\r\n */\r\nexport function attachEvent(\r\n emitter: events$EventEmitter,\r\n eventName: string,\r\n callback: Function,\r\n): IDisposable {\r\n emitter.addListener(eventName, callback);\r\n return new UniversalDisposable(() => {\r\n emitter.removeListener(eventName, callback);\r\n });\r\n}\r\n\r\ntype SubscribeCallback = (item: T) => any;\r\ntype SubscribeFunction = (\r\n callback: SubscribeCallback,\r\n) => IDisposable | (() => mixed);\r\n\r\nexport function observableFromSubscribeFunction(\r\n fn: SubscribeFunction,\r\n): Observable {\r\n return Observable.create(\r\n observer => new UniversalDisposable(fn(observer.next.bind(observer))),\r\n );\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport type {NuclideUri} from '@atom-ide-community/nuclide-commons/nuclideUri';\r\n\r\nimport invariant from 'assert';\r\nimport {TextEditor} from 'atom';\r\nimport {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\n\r\nimport {observableFromSubscribeFunction} from '@atom-ide-community/nuclide-commons/event';\r\n\r\n/**\r\n * Returns a text editor that has the given path open, or null if none exists. If there are multiple\r\n * text editors for this path, one is chosen arbitrarily.\r\n */\r\nexport function existingEditorForUri(path: NuclideUri): ?atom$TextEditor {\r\n // This isn't ideal but realistically iterating through even a few hundred editors shouldn't be a\r\n // real problem. And if you have more than a few hundred you probably have bigger problems.\r\n for (const editor of atom.workspace.getTextEditors()) {\r\n if (editor.getPath() === path) {\r\n return editor;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Returns a text editor that has the given buffer open, or null if none exists. If there are\r\n * multiple text editors for this buffer, one is chosen arbitrarily.\r\n */\r\nexport function existingEditorForBuffer(\r\n buffer: atom$TextBuffer,\r\n): ?atom$TextEditor {\r\n // This isn't ideal but realistically iterating through even a few hundred editors shouldn't be a\r\n // real problem. And if you have more than a few hundred you probably have bigger problems.\r\n for (const editor of atom.workspace.getTextEditors()) {\r\n if (editor.getBuffer() === buffer) {\r\n return editor;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport function getViewOfEditor(\r\n editor: atom$TextEditor,\r\n): atom$TextEditorElement {\r\n return atom.views.getView(editor);\r\n}\r\n\r\nexport function getScrollTop(editor: atom$TextEditor): number {\r\n return getViewOfEditor(editor).getScrollTop();\r\n}\r\n\r\nexport function setScrollTop(editor: atom$TextEditor, scrollTop: number): void {\r\n getViewOfEditor(editor).setScrollTop(scrollTop);\r\n}\r\n\r\n/**\r\n * Does a best effort to set an editor pane to a given cursor position & scroll.\r\n * Does not ensure that the current cursor position is visible.\r\n *\r\n * Can be used with editor.getCursorBufferPosition() & getScrollTop() to restore\r\n * an editors cursor and scroll.\r\n */\r\nexport function setPositionAndScroll(\r\n editor: atom$TextEditor,\r\n position: atom$Point,\r\n scrollTop: number,\r\n): void {\r\n editor.setCursorBufferPosition(position, {autoscroll: false});\r\n setScrollTop(editor, scrollTop);\r\n}\r\n\r\nexport function getCursorPositions(\r\n editor: atom$TextEditor,\r\n): Observable {\r\n return Observable.defer(() => {\r\n // This will behave strangely in the face of multiple cursors. Consider supporting multiple\r\n // cursors in the future.\r\n const cursor = editor.getCursors()[0];\r\n invariant(cursor != null);\r\n return Observable.merge(\r\n Observable.of(cursor.getBufferPosition()),\r\n observableFromSubscribeFunction(\r\n cursor.onDidChangePosition.bind(cursor),\r\n ).map(event => event.newBufferPosition),\r\n );\r\n });\r\n}\r\n\r\nexport function observeEditorDestroy(\r\n editor: atom$TextEditor,\r\n): Observable {\r\n return observableFromSubscribeFunction(editor.onDidDestroy.bind(editor))\r\n .map(event => editor)\r\n .take(1);\r\n}\r\n\r\n// Use atom readOnly attribute to set read-only state.\r\nexport function enforceReadOnlyEditor(\r\n textEditor: atom$TextEditor,\r\n readOnlyExceptions?: Array = ['append', 'setText'],\r\n): IDisposable {\r\n textEditor.getElement().setAttribute('readonly', '');\r\n return {\r\n dispose() {\r\n textEditor.getElement().removeAttribute('readonly');\r\n },\r\n };\r\n}\r\n\r\n// Turn off soft wrap setting for these editors so diffs properly align.\r\n// Some text editor register sometimes override the set soft wrapping\r\n// after mounting an editor to the workspace - here, that's watched and reset to `false`.\r\nexport function enforceSoftWrap(\r\n editor: atom$TextEditor,\r\n enforcedSoftWrap: boolean,\r\n): IDisposable {\r\n editor.setSoftWrapped(enforcedSoftWrap);\r\n return editor.onDidChangeSoftWrapped(softWrapped => {\r\n if (softWrapped !== enforcedSoftWrap) {\r\n // Reset the overridden softWrap to `false` once the operation completes.\r\n process.nextTick(() => {\r\n if (!editor.isDestroyed()) {\r\n editor.setSoftWrapped(enforcedSoftWrap);\r\n }\r\n });\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Checks if an object (typically an Atom pane) is a TextEditor.\r\n * Could be replaced with atom.workspace.isValidTextEditor,\r\n * but Flow doesn't support %checks in methods yet.\r\n */\r\nexport function isValidTextEditor(item: mixed): boolean %checks {\r\n return item instanceof TextEditor;\r\n}\r\n\r\nexport function centerScrollToBufferLine(\r\n textEditorElement: atom$TextEditorElement,\r\n bufferLineNumber: number,\r\n): void {\r\n const textEditor = textEditorElement.getModel();\r\n const pixelPositionTop = textEditorElement.pixelPositionForBufferPosition([\r\n bufferLineNumber,\r\n 0,\r\n ]).top;\r\n // Manually calculate the scroll location, instead of using\r\n // `textEditor.scrollToBufferPosition([lineNumber, 0], {center: true})`\r\n // because that API to wouldn't center the line if it was in the visible screen range.\r\n const scrollTop =\r\n pixelPositionTop +\r\n textEditor.getLineHeightInPixels() / 2 -\r\n textEditorElement.clientHeight / 2;\r\n textEditorElement.setScrollTop(Math.max(scrollTop, 1));\r\n\r\n textEditorElement.focus();\r\n\r\n textEditor.setCursorBufferPosition([bufferLineNumber, 0], {\r\n autoscroll: false,\r\n });\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow strict-local\r\n * @format\r\n */\r\n\r\nimport type {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\n\r\nimport {getLogger} from 'log4js';\r\nimport {Subject} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\nimport invariant from 'assert';\r\n\r\nexport type GoToLocationOptions = {|\r\n line?: number,\r\n column?: number,\r\n center?: boolean,\r\n activateItem?: boolean,\r\n activatePane?: boolean,\r\n pending?: boolean,\r\n moveCursor?: boolean,\r\n|};\r\n\r\n/**\r\n * Opens the given file.\r\n *\r\n * Optionally include a line and column to navigate to. If a line is given, by default it will\r\n * center it in the opened text editor.\r\n *\r\n * This should be preferred over `atom.workspace.open()` in typical cases. The motivations are:\r\n * - We call `atom.workspace.open()` with the `searchAllPanes` option. This looks in other panes for\r\n * the current file, rather just opening a new copy in the current pane. People often forget this\r\n * option which typically leads to a subpar experience for people who use multiple panes.\r\n * - When moving around in the current file, `goToLocation` explicitly publishes events that the nav\r\n * stack uses.\r\n *\r\n * Currently, `atom.workspace.open()` should be used only in these cases:\r\n * - When the URI to open is not a file URI. For example, if we want to open some tool like find\r\n * references in a pane.\r\n * - When we want to open an untitled file (providing no file argument). Currently, goToLocation\r\n * requires a file to open.\r\n * - When we want to open a file as a pending pane item. Currently goToLocation cannot do this.\r\n *\r\n * In these cases, you may disable the lint rule against `atom.workspace.open` by adding the\r\n * following comment above its use:\r\n * // eslint-disable-next-line nuclide-internal/atom-apis\r\n */\r\nexport async function goToLocation(\r\n file: string,\r\n options?: ?GoToLocationOptions,\r\n): Promise {\r\n const center = options?.center ?? true;\r\n const moveCursor = options?.moveCursor ?? true;\r\n const activatePane = options?.activatePane ?? true;\r\n const activateItem = options?.activateItem;\r\n const line = options?.line;\r\n const column = options?.column;\r\n const pending = options?.pending;\r\n\r\n // Prefer going to the current editor rather than the leftmost editor.\r\n const currentEditor = atom.workspace.getActiveTextEditor();\r\n if (currentEditor != null && currentEditor.getPath() === file) {\r\n const paneContainer = atom.workspace.paneContainerForItem(currentEditor);\r\n invariant(paneContainer != null);\r\n if (activatePane) {\r\n paneContainer.activate();\r\n }\r\n if (line != null) {\r\n goToLocationInEditor(currentEditor, {\r\n line,\r\n column: column == null ? 0 : column,\r\n center,\r\n moveCursor,\r\n });\r\n } else {\r\n invariant(column == null, 'goToLocation: Cannot specify just column');\r\n }\r\n return currentEditor;\r\n } else {\r\n // Obviously, calling goToLocation isn't a viable alternative here :P\r\n // eslint-disable-next-line nuclide-internal/atom-apis\r\n const editor = await atom.workspace.open(file, {\r\n initialLine: line,\r\n initialColumn: column,\r\n searchAllPanes: true,\r\n activatePane,\r\n activateItem,\r\n pending,\r\n });\r\n // TODO(T28305560) Investigate offenders for this error\r\n if (editor == null) {\r\n const tmp = {};\r\n Error.captureStackTrace(tmp);\r\n const error = Error(`atom.workspace.open returned null on ${file}`);\r\n getLogger('goToLocation').error(error);\r\n throw error;\r\n }\r\n\r\n if (center && line != null) {\r\n editor.scrollToBufferPosition([line, column], {center: true});\r\n }\r\n return editor;\r\n }\r\n}\r\n\r\nconst goToLocationSubject = new Subject();\r\n\r\ntype GotoLocationInEditorOptions = {|\r\n line: number,\r\n column: number,\r\n center?: boolean,\r\n moveCursor?: boolean,\r\n|};\r\n\r\n// Scrolls to the given line/column at the given editor\r\n// broadcasts the editor instance on an observable (subject) available\r\n// through the getGoToLocation\r\nexport function goToLocationInEditor(\r\n editor: atom$TextEditor,\r\n options: GotoLocationInEditorOptions,\r\n): void {\r\n const center = options.center == null ? true : options.center;\r\n const moveCursor = options.moveCursor == null ? true : options.moveCursor;\r\n const {line, column} = options;\r\n\r\n if (moveCursor) {\r\n editor.setCursorBufferPosition([line, column]);\r\n }\r\n if (center) {\r\n editor.scrollToBufferPosition([line, column], {center: true});\r\n }\r\n\r\n goToLocationSubject.next(editor);\r\n}\r\n\r\nexport function observeNavigatingEditors(): Observable {\r\n return goToLocationSubject;\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow strict-local\r\n * @format\r\n */\r\n\r\nimport type {NuclideUri} from '@atom-ide-community/nuclide-commons/nuclideUri';\r\n\r\nimport invariant from 'assert';\r\nimport {getLogger} from 'log4js';\r\n\r\nimport {existingEditorForUri} from './text-editor';\r\nimport {goToLocation} from './go-to-location';\r\n\r\nexport type TextEdit = {\r\n oldRange: atom$Range,\r\n newText: string,\r\n // If included, this will be used to verify that the edit still applies cleanly.\r\n oldText?: string,\r\n};\r\n\r\n/**\r\n * Attempts to apply the given patches for multiple files. Accepts a Map as input\r\n * with file paths as keys and a corresponding array of TextEdits as values.\r\n *\r\n * It is an error to send overlapping text-edits. All text-edits describe changes\r\n * made to the initial document version. The order of the edits does not matter\r\n * as they will be sorted before they are applied.\r\n *\r\n * All changes will be applied to the buffers but not saved. If a file is not\r\n * currently open, it will be opened.\r\n *\r\n * If a change is undone (Cmd+Z), only the changes of the current\r\n * file will be undone. All of the changes for that file will be undone at once.\r\n *\r\n * Returns true if the application was successful, otherwise false. If any of\r\n * the changes fail, for ANY file, then none of the changes are applied.\r\n */\r\nexport async function applyTextEditsForMultipleFiles(\r\n changes: Map>,\r\n): Promise {\r\n const paths = Array.from(changes.keys());\r\n\r\n // NOTE: There is a race here. If the file contents change while the\r\n // editors are being opened, then the ranges of the TextEdits will be off.\r\n // However, currently this is only used to applyEdits to open files.\r\n const editors = await Promise.all(\r\n paths.map(async path => goToLocation(path)),\r\n );\r\n const checkpoints = editors.map(editor => {\r\n invariant(editor != null);\r\n const buffer = editor.getBuffer();\r\n return [buffer, buffer.createCheckpoint()];\r\n });\r\n const allOkay = paths.reduce((successSoFar, path) => {\r\n const edits = changes.get(path);\r\n return successSoFar && edits != null && applyTextEdits(path, ...edits);\r\n }, true);\r\n if (!allOkay) {\r\n checkpoints.forEach(([buffer, checkPoint]) => {\r\n buffer.revertToCheckpoint(checkPoint);\r\n return false;\r\n });\r\n }\r\n return allOkay;\r\n}\r\n\r\n/**\r\n * Attempts to apply the given patches to the given file.\r\n *\r\n * It is an error to send overlapping edits. The order of the edits does not\r\n * matter (they will be sorted before they are applied).\r\n *\r\n * The file must be currently open in Atom, and the changes will be applied to the buffer but not\r\n * saved.\r\n *\r\n * Returns true if the application was successful, otherwise false (e.g. if the oldText did not\r\n * match).\r\n */\r\nexport function applyTextEdits(\r\n path: NuclideUri,\r\n ...edits: Array\r\n): boolean {\r\n const sortedEdits = sortEdits(edits);\r\n const editor = existingEditorForUri(path);\r\n invariant(editor != null);\r\n return applySortedTextEditsToBuffer(editor.getBuffer(), sortedEdits);\r\n}\r\n\r\nexport function applyTextEditsToBuffer(\r\n buffer: atom$TextBuffer | simpleTextBuffer$TextBuffer,\r\n edits: Array,\r\n): boolean {\r\n return applySortedTextEditsToBuffer(buffer, sortEdits(edits));\r\n}\r\n\r\nfunction applySortedTextEditsToBuffer(\r\n buffer: atom$TextBuffer | simpleTextBuffer$TextBuffer,\r\n edits: Array,\r\n): boolean {\r\n // For every edit, the start of its range will be after the end of the\r\n // previous edit's range.\r\n if (editsOverlap(edits)) {\r\n getLogger('text-edit').warn(\r\n 'applyTextEdits was called with overlapping edits.',\r\n );\r\n return false;\r\n }\r\n // Special-case whole-buffer changes to minimize disruption.\r\n if (edits.length === 1 && edits[0].oldRange.isEqual(buffer.getRange())) {\r\n if (edits[0].oldText != null && edits[0].oldText !== buffer.getText()) {\r\n return false;\r\n }\r\n buffer.setTextViaDiff(edits[0].newText);\r\n return true;\r\n }\r\n\r\n const checkpoint = buffer.createCheckpoint();\r\n\r\n // Iterate through in reverse order. Edits earlier in the file can move around text later in the\r\n // file, so to avoid conflicts edits should be applied last first.\r\n for (let i = edits.length - 1; i >= 0; i--) {\r\n const edit = edits[i];\r\n const success = applyToBuffer(buffer, edit);\r\n if (!success) {\r\n buffer.revertToCheckpoint(checkpoint);\r\n return false;\r\n }\r\n }\r\n\r\n buffer.groupChangesSinceCheckpoint(checkpoint);\r\n return true;\r\n}\r\n\r\nfunction applyToBuffer(\r\n buffer: atom$TextBuffer | simpleTextBuffer$TextBuffer,\r\n edit: TextEdit,\r\n): boolean {\r\n if (edit.oldRange.start.row === edit.oldRange.end.row) {\r\n // A little extra validation when the old range spans only one line. In particular, this helps\r\n // when the old range is empty so there is no old text for us to compare against. We can at\r\n // least abort if the line isn't long enough.\r\n const lineLength = buffer.lineLengthForRow(edit.oldRange.start.row);\r\n if (edit.oldRange.end.column > lineLength) {\r\n return false;\r\n }\r\n }\r\n if (edit.oldText != null) {\r\n const currentText = buffer.getTextInRange(edit.oldRange);\r\n if (currentText !== edit.oldText) {\r\n return false;\r\n }\r\n }\r\n buffer.setTextInRange(edit.oldRange, edit.newText);\r\n return true;\r\n}\r\n\r\n// Returns whether an array of sorted TextEdits contain an overlapping range.\r\nfunction editsOverlap(sortedEdits: Array): boolean {\r\n for (let i = 0; i < sortedEdits.length - 1; i++) {\r\n if (\r\n sortedEdits[i].oldRange.end.isGreaterThan(\r\n sortedEdits[i + 1].oldRange.start,\r\n )\r\n ) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction sortEdits(edits: Array): Array {\r\n // stable sort (preserve order of edits starting in the same location)\r\n return edits\r\n .map((edit, i) => [edit, i])\r\n .sort(\r\n ([e1, i1], [e2, i2]) =>\r\n e1.oldRange.start.compare(e2.oldRange.start) ||\r\n e1.oldRange.end.compare(e2.oldRange.end) ||\r\n i1 - i2,\r\n )\r\n .map(([edit]) => edit);\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport type {Provider} from './ProviderRegistry';\r\nimport type {TextEdit} from './text-edit';\r\n\r\nimport {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\nimport {track} from '@atom-ide-community/nuclide-commons/analytics';\r\nimport ProviderRegistry from './ProviderRegistry';\r\nimport {applyTextEditsToBuffer} from './text-edit';\r\nimport UniversalDisposable from '@atom-ide-community/nuclide-commons/UniversalDisposable';\r\n\r\nexport type FileEventHandlersConfig = {|\r\n supportsOnWillSave: boolean,\r\n onWillSaveTimeout?: number,\r\n onWillSavePriority?: number,\r\n|};\r\n\r\ntype OnWillSaveProvider = Provider & {\r\n timeout: number,\r\n callback: (e: atom$TextEditor) => Observable,\r\n};\r\n\r\n// Timeouts if providers don't all finish in 5 seconds.\r\nconst GLOBAL_SAVE_TIMEOUT_MS = 5000;\r\nconst onWillSaveProviders: ProviderRegistry<\r\n OnWillSaveProvider,\r\n> = new ProviderRegistry();\r\n\r\n// Returns an observable of booleans, each of which indicates whether the\r\n// formatting text edits from a given provider was successfully applied or not.\r\nfunction onWillSave(editor: atom$TextEditor): Observable {\r\n if (editor.getPath() == null) {\r\n return Observable.empty();\r\n }\r\n\r\n const providers = Array.from(\r\n onWillSaveProviders.getAllProvidersForEditor(editor),\r\n );\r\n // NOTE: concat() is used here to subscribe to providers sequentially and\r\n // apply their text edits in order.\r\n return Observable.concat(\r\n ...providers.map((provider: OnWillSaveProvider) =>\r\n provider\r\n .callback(editor)\r\n .toArray()\r\n .race(Observable.of([]).delay(provider.timeout))\r\n .map(edits => {\r\n const success = applyTextEditsToBuffer(editor.getBuffer(), edits);\r\n return success;\r\n }),\r\n ),\r\n );\r\n}\r\n\r\n// HACK: intercept the real TextEditor.save and handle it ourselves.\r\n// Atom has no way of injecting content into the buffer asynchronously\r\n// before a save operation.\r\n// If we try to format after the save, and then save again,\r\n// it's a poor user experience (and also races the text buffer's reload).\r\nfunction patchEditorSave(editor: atom$TextEditor): IDisposable {\r\n const realSave = editor.save;\r\n const editor_ = (editor: any);\r\n editor_.save = async () => {\r\n const timeout = new Date();\r\n timeout.setTime(timeout.getTime() + GLOBAL_SAVE_TIMEOUT_MS);\r\n try {\r\n await onWillSave(editor_)\r\n .timeout(timeout)\r\n .toPromise();\r\n } catch (e) {\r\n const providers = Array.from(\r\n onWillSaveProviders.getAllProvidersForEditor(editor_),\r\n );\r\n track('timeout-on-save', {\r\n uri: editor.getPath(),\r\n providers,\r\n });\r\n } finally {\r\n await realSave.call(editor);\r\n }\r\n };\r\n return new UniversalDisposable(() => {\r\n editor_.save = realSave;\r\n });\r\n}\r\n\r\nexport function registerOnWillSave(provider: OnWillSaveProvider): IDisposable {\r\n return onWillSaveProviders.addProvider(provider);\r\n}\r\n\r\nexport function observeTextEditors(): IDisposable {\r\n const disposables = new UniversalDisposable();\r\n disposables.add(\r\n atom.workspace.observeTextEditors(editor => {\r\n disposables.add(patchEditorSave(editor));\r\n }),\r\n );\r\n return disposables;\r\n}\r\n","import { Disposable, TextEditor } from \"atom\"\nimport { Provider as ProviderTypes, BusySignalProvider, FindReferencesProvider } from \"../types-packages/main.d\"\n\nexport class ProviderRegistry> {\n private providers: Array\n\n constructor() {\n this.providers = []\n }\n\n addProvider(provider: Provider): Disposable {\n const index = this.providers.findIndex((p) => provider.priority > p.priority)\n if (index === -1) {\n this.providers.push(provider)\n } else {\n this.providers.splice(index, 0, provider)\n }\n return new Disposable(() => {\n this.removeProvider(provider)\n })\n }\n\n removeProvider(provider: Provider): void {\n const index = this.providers.indexOf(provider)\n if (index !== -1) {\n this.providers.splice(index, 1)\n }\n }\n\n // TODO deprecate since there can be N providers.\n getProviderForEditor(editor: TextEditor): Provider | null {\n const grammar = editor.getGrammar().scopeName\n return this.findProvider(grammar)\n }\n\n // TODO create an ordering or priority aware util to prefer instead.\n getAllProvidersForEditor(editor: TextEditor): Iterable {\n const grammar = editor.getGrammar().scopeName\n return this.findAllProviders(grammar)\n }\n\n findProvider(grammar: string): Provider | null {\n for (const provider of this.findAllProviders(grammar)) {\n return provider\n }\n return null\n }\n\n /** Iterates over all providers matching the grammar, in priority order. */\n *findAllProviders(grammar: string): Iterable {\n for (const provider of this.providers) {\n if (provider.grammarScopes == null || provider.grammarScopes.indexOf(grammar) !== -1) {\n yield provider\n }\n }\n }\n}\n","(function (factory) {\n if (typeof module === \"object\" && typeof module.exports === \"object\") {\n var v = factory(require, exports);\n if (v !== undefined) module.exports = v;\n }\n else if (typeof define === \"function\" && define.amd) {\n define([\"require\", \"exports\"], factory);\n }\n})(function (require, exports) {\n /*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n 'use strict';\n Object.defineProperty(exports, \"__esModule\", { value: true });\n function _encode(ch) {\n return '%' + ch.charCodeAt(0).toString(16).toUpperCase();\n }\n // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent\n function encodeURIComponent2(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, _encode);\n }\n function encodeNoop(str) {\n return str.replace(/[#?]/, _encode);\n }\n /**\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\n * This class is a simple parser which creates the basic component paths\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\n * and encoding.\n *\n * foo://example.com:8042/over/there?name=ferret#nose\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\n * | | | | |\n * scheme authority path query fragment\n * | _____________________|__\n * / \\ / \\\n * urn:example:animal:ferret:nose\n *\n *\n */\n var URI = (function () {\n function URI() {\n this._scheme = URI._empty;\n this._authority = URI._empty;\n this._path = URI._empty;\n this._query = URI._empty;\n this._fragment = URI._empty;\n this._formatted = null;\n this._fsPath = null;\n }\n URI.isUri = function (thing) {\n if (thing instanceof URI) {\n return true;\n }\n if (!thing) {\n return false;\n }\n return typeof thing.authority === 'string'\n && typeof thing.fragment === 'string'\n && typeof thing.path === 'string'\n && typeof thing.query === 'string'\n && typeof thing.scheme === 'string';\n };\n Object.defineProperty(URI.prototype, \"scheme\", {\n /**\n * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.\n * The part before the first colon.\n */\n get: function () {\n return this._scheme;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"authority\", {\n /**\n * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'.\n * The part between the first double slashes and the next slash.\n */\n get: function () {\n return this._authority;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"path\", {\n /**\n * path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.\n */\n get: function () {\n return this._path;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"query\", {\n /**\n * query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.\n */\n get: function () {\n return this._query;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"fragment\", {\n /**\n * fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.\n */\n get: function () {\n return this._fragment;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"fsPath\", {\n // ---- filesystem path -----------------------\n /**\n * Returns a string representing the corresponding file system path of this URI.\n * Will handle UNC paths and normalize windows drive letters to lower-case. Also\n * uses the platform specific path separator. Will *not* validate the path for\n * invalid characters and semantics. Will *not* look at the scheme of this URI.\n */\n get: function () {\n if (!this._fsPath) {\n var value;\n if (this._authority && this._path && this.scheme === 'file') {\n // unc path: file://shares/c$/far/boo\n value = \"//\" + this._authority + this._path;\n }\n else if (URI._driveLetterPath.test(this._path)) {\n // windows drive letter: file:///c:/far/boo\n value = this._path[1].toLowerCase() + this._path.substr(2);\n }\n else {\n // other path\n value = this._path;\n }\n if (isWindows) {\n value = value.replace(/\\//g, '\\\\');\n }\n this._fsPath = value;\n }\n return this._fsPath;\n },\n enumerable: true,\n configurable: true\n });\n // ---- modify to new -------------------------\n URI.prototype.with = function (change) {\n if (!change) {\n return this;\n }\n var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment;\n if (scheme === void 0) {\n scheme = this.scheme;\n }\n else if (scheme === null) {\n scheme = '';\n }\n if (authority === void 0) {\n authority = this.authority;\n }\n else if (authority === null) {\n authority = '';\n }\n if (path === void 0) {\n path = this.path;\n }\n else if (path === null) {\n path = '';\n }\n if (query === void 0) {\n query = this.query;\n }\n else if (query === null) {\n query = '';\n }\n if (fragment === void 0) {\n fragment = this.fragment;\n }\n else if (fragment === null) {\n fragment = '';\n }\n if (scheme === this.scheme\n && authority === this.authority\n && path === this.path\n && query === this.query\n && fragment === this.fragment) {\n return this;\n }\n var ret = new URI();\n ret._scheme = scheme;\n ret._authority = authority;\n ret._path = path;\n ret._query = query;\n ret._fragment = fragment;\n URI._validate(ret);\n return ret;\n };\n // ---- parse & validate ------------------------\n URI.parse = function (value) {\n var ret = new URI();\n var data = URI._parseComponents(value);\n ret._scheme = data.scheme;\n ret._authority = decodeURIComponent(data.authority);\n ret._path = decodeURIComponent(data.path);\n ret._query = decodeURIComponent(data.query);\n ret._fragment = decodeURIComponent(data.fragment);\n URI._validate(ret);\n return ret;\n };\n URI.file = function (path) {\n var ret = new URI();\n ret._scheme = 'file';\n // normalize to fwd-slashes on windows,\n // on other systems bwd-slaches are valid\n // filename character, eg /f\\oo/ba\\r.txt\n if (isWindows) {\n path = path.replace(/\\\\/g, URI._slash);\n }\n // check for authority as used in UNC shares\n // or use the path as given\n if (path[0] === URI._slash && path[0] === path[1]) {\n var idx = path.indexOf(URI._slash, 2);\n if (idx === -1) {\n ret._authority = path.substring(2);\n }\n else {\n ret._authority = path.substring(2, idx);\n ret._path = path.substring(idx);\n }\n }\n else {\n ret._path = path;\n }\n // Ensure that path starts with a slash\n // or that it is at least a slash\n if (ret._path[0] !== URI._slash) {\n ret._path = URI._slash + ret._path;\n }\n URI._validate(ret);\n return ret;\n };\n URI._parseComponents = function (value) {\n var ret = {\n scheme: URI._empty,\n authority: URI._empty,\n path: URI._empty,\n query: URI._empty,\n fragment: URI._empty,\n };\n var match = URI._regexp.exec(value);\n if (match) {\n ret.scheme = match[2] || ret.scheme;\n ret.authority = match[4] || ret.authority;\n ret.path = match[5] || ret.path;\n ret.query = match[7] || ret.query;\n ret.fragment = match[9] || ret.fragment;\n }\n return ret;\n };\n URI.from = function (components) {\n return new URI().with(components);\n };\n URI._validate = function (ret) {\n // scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n // ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n if (ret.scheme && !URI._schemePattern.test(ret.scheme)) {\n throw new Error('[UriError]: Scheme contains illegal characters.');\n }\n // path, http://tools.ietf.org/html/rfc3986#section-3.3\n // If a URI contains an authority component, then the path component\n // must either be empty or begin with a slash (\"/\") character. If a URI\n // does not contain an authority component, then the path cannot begin\n // with two slash characters (\"//\").\n if (ret.path) {\n if (ret.authority) {\n if (!URI._singleSlashStart.test(ret.path)) {\n throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\n }\n }\n else {\n if (URI._doubleSlashStart.test(ret.path)) {\n throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n }\n }\n }\n };\n // ---- printing/externalize ---------------------------\n /**\n *\n * @param skipEncoding Do not encode the result, default is `false`\n */\n URI.prototype.toString = function (skipEncoding) {\n if (skipEncoding === void 0) { skipEncoding = false; }\n if (!skipEncoding) {\n if (!this._formatted) {\n this._formatted = URI._asFormatted(this, false);\n }\n return this._formatted;\n }\n else {\n // we don't cache that\n return URI._asFormatted(this, true);\n }\n };\n URI._asFormatted = function (uri, skipEncoding) {\n var encoder = !skipEncoding\n ? encodeURIComponent2\n : encodeNoop;\n var parts = [];\n var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment;\n if (scheme) {\n parts.push(scheme, ':');\n }\n if (authority || scheme === 'file') {\n parts.push('//');\n }\n if (authority) {\n authority = authority.toLowerCase();\n var idx = authority.indexOf(':');\n if (idx === -1) {\n parts.push(encoder(authority));\n }\n else {\n parts.push(encoder(authority.substr(0, idx)), authority.substr(idx));\n }\n }\n if (path) {\n // lower-case windows drive letters in /C:/fff or C:/fff\n var m = URI._upperCaseDrive.exec(path);\n if (m) {\n if (m[1]) {\n path = '/' + m[2].toLowerCase() + path.substr(3); // \"/c:\".length === 3\n }\n else {\n path = m[2].toLowerCase() + path.substr(2); // // \"c:\".length === 2\n }\n }\n // encode every segement but not slashes\n // make sure that # and ? are always encoded\n // when occurring in paths - otherwise the result\n // cannot be parsed back again\n var lastIdx = 0;\n while (true) {\n var idx = path.indexOf(URI._slash, lastIdx);\n if (idx === -1) {\n parts.push(encoder(path.substring(lastIdx)));\n break;\n }\n parts.push(encoder(path.substring(lastIdx, idx)), URI._slash);\n lastIdx = idx + 1;\n }\n ;\n }\n if (query) {\n parts.push('?', encoder(query));\n }\n if (fragment) {\n parts.push('#', encoder(fragment));\n }\n return parts.join(URI._empty);\n };\n URI.prototype.toJSON = function () {\n var res = {\n fsPath: this.fsPath,\n external: this.toString(),\n $mid: 1\n };\n if (this.path) {\n res.path = this.path;\n }\n if (this.scheme) {\n res.scheme = this.scheme;\n }\n if (this.authority) {\n res.authority = this.authority;\n }\n if (this.query) {\n res.query = this.query;\n }\n if (this.fragment) {\n res.fragment = this.fragment;\n }\n return res;\n };\n URI.revive = function (data) {\n var result = new URI();\n result._scheme = data.scheme || URI._empty;\n result._authority = data.authority || URI._empty;\n result._path = data.path || URI._empty;\n result._query = data.query || URI._empty;\n result._fragment = data.fragment || URI._empty;\n result._fsPath = data.fsPath;\n result._formatted = data.external;\n URI._validate(result);\n return result;\n };\n return URI;\n }());\n URI._empty = '';\n URI._slash = '/';\n URI._regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n URI._driveLetterPath = /^\\/[a-zA-z]:/;\n URI._upperCaseDrive = /^(\\/)?([A-Z]:)/;\n URI._schemePattern = /^\\w[\\w\\d+.-]*$/;\n URI._singleSlashStart = /^\\//;\n URI._doubleSlashStart = /^\\/\\//;\n exports.default = URI;\n var isWindows;\n if (typeof process === 'object') {\n isWindows = process.platform === 'win32';\n }\n else if (typeof navigator === 'object') {\n var userAgent = navigator.userAgent;\n isWindows = userAgent.indexOf('Windows') >= 0;\n }\n});\n","/**\r\nModified from https://github.com/substack/node-shell-quote/commit/72fb5a8.\r\nIncludes https://github.com/substack/node-shell-quote/pull/29, with minor\r\nmodifications to remove the unnecessary Array polyfills.\r\n\r\nUse the typed wrappers in ./string.js to access these functions.\r\n\r\nThe MIT License\r\n\r\nCopyright (c) 2013 James Halliday (mail@substack.net)\r\n\r\nPermission is hereby granted, free of charge,\r\nto any person obtaining a copy of this software and\r\nassociated documentation files (the \"Software\"), to\r\ndeal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify,\r\nmerge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom\r\nthe Software is furnished to do so,\r\nsubject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice\r\nshall be included in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\r\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR\r\nANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n@noflow\r\n*/\r\n\r\n/* eslint-disable */\r\n\r\nexports.quote = function (xs) {\r\n return xs.map(function (s) {\r\n if (s && typeof s === 'object') {\r\n return s.op.replace(/(.)/g, '\\\\$1');\r\n }\r\n else if (/[\"\\s]/.test(s) && !/'/.test(s)) {\r\n return \"'\" + s.replace(/(['\\\\])/g, '\\\\$1') + \"'\";\r\n }\r\n else if (/[\"'\\s]/.test(s)) {\r\n return '\"' + s.replace(/([\"\\\\$`!])/g, '\\\\$1') + '\"';\r\n }\r\n else {\r\n return String(s).replace(/([#!\"$&'()*,:;<=>?@\\[\\\\\\]^`{|}])/g, '\\\\$1');\r\n }\r\n }).join(' ');\r\n};\r\n\r\nvar CONTROL = '(?:' + [\r\n '\\\\|\\\\|', '\\\\&\\\\&', ';;', '\\\\|\\\\&', '[&;()|<>]'\r\n].join('|') + ')';\r\nvar META = '|&;()<> \\\\t';\r\nvar BAREWORD = '(\\\\\\\\[\\'\"' + META + ']|[^\\\\s\\'\"' + META + '])+';\r\nvar SINGLE_QUOTE = '\"((\\\\\\\\\"|[^\"])*?)\"';\r\nvar DOUBLE_QUOTE = '\\'((\\\\\\\\\\'|[^\\'])*?)\\'';\r\n\r\nvar TOKEN = '';\r\nfor (var i = 0; i < 4; i++) {\r\n TOKEN += (Math.pow(16,8)*Math.random()).toString(16);\r\n}\r\n\r\nexports.parse = function (s, env, opts) {\r\n var mapped = parse(s, env, opts);\r\n if (typeof env !== 'function') return mapped;\r\n return mapped.reduce(function (acc, s) {\r\n if (typeof s === 'object') return acc.concat(s);\r\n var xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));\r\n if (xs.length === 1) return acc.concat(xs[0]);\r\n return acc.concat(xs.filter(Boolean).map(function (x) {\r\n if (RegExp('^' + TOKEN).test(x)) {\r\n return JSON.parse(x.split(TOKEN)[1]); }\r\n else return x;\r\n }));\r\n }, []);\r\n};\r\n\r\nfunction parse (s, env, opts) {\r\n var chunker = new RegExp([\r\n '(' + CONTROL + ')', // control chars\r\n '(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')*'\r\n ].join('|'), 'g');\r\n var match = s.match(chunker).filter(Boolean);\r\n var commented = false;\r\n\r\n if (!match) return [];\r\n if (!env) env = {};\r\n if (!opts) opts = {};\r\n return match.map(function (s, j) {\r\n if (commented) {\r\n return;\r\n }\r\n if (s.charAt(0) === '#') {\r\n commented = true;\r\n return { comment: s.substr(1) + match.slice(j+1).join(' ') };\r\n }\r\n if (RegExp('^' + CONTROL + '$').test(s)) {\r\n return { op: s };\r\n }\r\n\r\n // Hand-written scanner/parser for Bash quoting rules:\r\n //\r\n // 1. inside single quotes, all characters are printed literally.\r\n // 2. inside double quotes, all characters are printed literally\r\n // except variables prefixed by '$' and backslashes followed by\r\n // either a double quote or another backslash.\r\n // 3. outside of any quotes, backslashes are treated as escape\r\n // characters and not printed (unless they are themselves escaped)\r\n // 4. quote context can switch mid-token if there is no whitespace\r\n // between the two quote contexts (e.g. all'one'\"token\" parses as\r\n // \"allonetoken\")\r\n var SQ = \"'\";\r\n var DQ = '\"';\r\n var DS = '$';\r\n var BS = opts.escape || '\\\\';\r\n var quote = false;\r\n var esc = false;\r\n var out = '';\r\n var isGlob = false;\r\n\r\n for (var i = 0, len = s.length; i < len; i++) {\r\n var c = s.charAt(i);\r\n isGlob = isGlob || (!quote && (c === '*' || c === '?'));\r\n if (esc) {\r\n out += c;\r\n esc = false;\r\n }\r\n else if (quote) {\r\n if (c === quote) {\r\n quote = false;\r\n }\r\n else if (quote == SQ) {\r\n out += c;\r\n }\r\n else { // Double quote\r\n if (c === BS) {\r\n i += 1;\r\n c = s.charAt(i);\r\n if (c === DQ || c === BS || c === DS) {\r\n out += c;\r\n } else {\r\n out += BS + c;\r\n }\r\n }\r\n else if (c === DS) {\r\n out += parseEnvVar();\r\n }\r\n else {\r\n out += c;\r\n }\r\n }\r\n }\r\n else if (c === DQ || c === SQ) {\r\n quote = c;\r\n }\r\n else if (RegExp('^' + CONTROL + '$').test(c)) {\r\n return { op: s };\r\n }\r\n else if (c === BS) {\r\n esc = true;\r\n }\r\n else if (c === DS) {\r\n out += parseEnvVar();\r\n }\r\n else out += c;\r\n }\r\n\r\n if (isGlob) return {op: 'glob', pattern: out};\r\n\r\n return out;\r\n\r\n function parseEnvVar() {\r\n i += 1;\r\n var varend, varname;\r\n //debugger\r\n if (s.charAt(i) === '{') {\r\n i += 1;\r\n if (s.charAt(i) === '}') {\r\n throw new Error(\"Bad substitution: \" + s.substr(i - 2, 3));\r\n }\r\n varend = s.indexOf('}', i);\r\n if (varend < 0) {\r\n throw new Error(\"Bad substitution: \" + s.substr(i));\r\n }\r\n varname = s.substr(i, varend - i);\r\n i = varend;\r\n }\r\n else if (/[*@#?$!_\\-]/.test(s.charAt(i))) {\r\n varname = s.charAt(i);\r\n i += 1;\r\n }\r\n else {\r\n varend = s.substr(i).match(/[^\\w\\d_]/);\r\n if (!varend) {\r\n varname = s.substr(i);\r\n i = s.length;\r\n } else {\r\n varname = s.substr(i, varend.index);\r\n i += varend.index - 1;\r\n }\r\n }\r\n return getVar(null, '', varname);\r\n }\r\n })\r\n // finalize parsed aruments\r\n .reduce(function(prev, arg){\r\n if (arg === undefined){\r\n return prev;\r\n }\r\n return prev.concat(arg);\r\n },[]);\r\n\r\n function getVar (_, pre, key) {\r\n var r = typeof env === 'function' ? env(key) : env[key];\r\n if (r === undefined) r = '';\r\n\r\n if (typeof r === 'object') {\r\n return pre + TOKEN + JSON.stringify(r) + TOKEN;\r\n }\r\n else return pre + r;\r\n }\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport invariant from 'assert';\r\nimport {parse, quote} from './_shell-quote';\r\n\r\nexport function stringifyError(error: Error): string {\r\n return `name: ${error.name}, message: ${error.message}, stack: ${\r\n error.stack\r\n }.`;\r\n}\r\n\r\n// As of Flow v0.28, Flow does not alllow implicit string coercion of null or undefined. Use this to\r\n// make it explicit.\r\nexport function maybeToString(str: ?string): string {\r\n // We don't want to encourage the use of this function directly because it coerces anything to a\r\n // string. We get stricter typechecking by using maybeToString, so it should generally be\r\n // preferred.\r\n return String(str);\r\n}\r\n\r\n/**\r\n * Originally adapted from https://github.com/azer/relative-date.\r\n * We're including it because of https://github.com/npm/npm/issues/12012\r\n */\r\nconst SECOND = 1000;\r\nconst MINUTE = 60 * SECOND;\r\nconst HOUR = 60 * MINUTE;\r\nconst DAY = 24 * HOUR;\r\nconst WEEK = 7 * DAY;\r\nconst YEAR = DAY * 365;\r\nconst MONTH = YEAR / 12;\r\n\r\nconst shortFormats = [\r\n [0.7 * MINUTE, 'now'],\r\n [1.5 * MINUTE, '1m'],\r\n [60 * MINUTE, 'm', MINUTE],\r\n [1.5 * HOUR, '1h'],\r\n [DAY, 'h', HOUR],\r\n [2 * DAY, '1d'],\r\n [7 * DAY, 'd', DAY],\r\n [1.5 * WEEK, '1w'],\r\n [MONTH, 'w', WEEK],\r\n [1.5 * MONTH, '1mo'],\r\n [YEAR, 'mo', MONTH],\r\n [1.5 * YEAR, '1y'],\r\n [Number.MAX_VALUE, 'y', YEAR],\r\n];\r\n\r\nconst longFormats = [\r\n [0.7 * MINUTE, 'just now'],\r\n [1.5 * MINUTE, 'a minute ago'],\r\n [60 * MINUTE, 'minutes ago', MINUTE],\r\n [1.5 * HOUR, 'an hour ago'],\r\n [DAY, 'hours ago', HOUR],\r\n [2 * DAY, 'yesterday'],\r\n [7 * DAY, 'days ago', DAY],\r\n [1.5 * WEEK, 'a week ago'],\r\n [MONTH, 'weeks ago', WEEK],\r\n [1.5 * MONTH, 'a month ago'],\r\n [YEAR, 'months ago', MONTH],\r\n [1.5 * YEAR, 'a year ago'],\r\n [Number.MAX_VALUE, 'years ago', YEAR],\r\n];\r\n\r\nconst longFormatsNumbers = [\r\n [0.7 * MINUTE, 'just now'],\r\n [1.5 * MINUTE, '1 minute ago'],\r\n [60 * MINUTE, 'minutes ago', MINUTE],\r\n [1.5 * HOUR, '1 hour ago'],\r\n [DAY, 'hours ago', HOUR],\r\n [2 * DAY, 'yesterday'],\r\n [7 * DAY, 'days ago', DAY],\r\n [1.5 * WEEK, '1 week ago'],\r\n [MONTH, 'weeks ago', WEEK],\r\n [1.5 * MONTH, '1 month ago'],\r\n [YEAR, 'months ago', MONTH],\r\n [1.5 * YEAR, '1 year ago'],\r\n [Number.MAX_VALUE, 'years ago', YEAR],\r\n];\r\n\r\nexport function relativeDate(\r\n input_: number | Date,\r\n reference_?: number | Date,\r\n useShortVariant?: boolean = false,\r\n useNumbersOnly?: boolean = false,\r\n): string {\r\n let input = input_;\r\n let reference = reference_;\r\n if (input instanceof Date) {\r\n input = input.getTime();\r\n }\r\n // flowlint-next-line sketchy-null-number:off\r\n if (!reference) {\r\n reference = new Date().getTime();\r\n }\r\n if (reference instanceof Date) {\r\n reference = reference.getTime();\r\n }\r\n\r\n const delta = reference - input;\r\n const formats = useShortVariant\r\n ? shortFormats\r\n : useNumbersOnly\r\n ? longFormatsNumbers\r\n : longFormats;\r\n for (const [limit, relativeFormat, remainder] of formats) {\r\n if (delta < limit) {\r\n if (typeof remainder === 'number') {\r\n return (\r\n Math.round(delta / remainder) +\r\n (useShortVariant ? '' : ' ') +\r\n relativeFormat\r\n );\r\n } else {\r\n return relativeFormat;\r\n }\r\n }\r\n }\r\n\r\n throw new Error('This should never be reached.');\r\n}\r\n\r\n/**\r\n * Count the number of occurrences of `char` in `str`.\r\n * `char` must be a string of length 1.\r\n */\r\nexport function countOccurrences(haystack: string, char: string) {\r\n invariant(char.length === 1, 'char must be a string of length 1');\r\n\r\n let count = 0;\r\n const code = char.charCodeAt(0);\r\n for (let i = 0; i < haystack.length; i++) {\r\n if (haystack.charCodeAt(i) === code) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n}\r\n\r\n/**\r\n * shell-quote's parse allows pipe operators and comments.\r\n * Generally users don't care about this, so throw if we encounter any operators.\r\n */\r\nexport function shellParse(str: string, env?: Object): Array {\r\n const result = parse(str, env);\r\n for (let i = 0; i < result.length; i++) {\r\n if (typeof result[i] !== 'string') {\r\n if (result[i].op != null) {\r\n throw new Error(\r\n `Unexpected operator \"${result[i].op}\" provided to shellParse`,\r\n );\r\n } else {\r\n throw new Error(\r\n `Unexpected comment \"${result[i].comment}\" provided to shellParse`,\r\n );\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * shell-quote's parse allows pipe operators and comments and globs\r\n * We treat glob patterns as normal strings. For the other operators, we throw.\r\n */\r\nexport function shellParseWithGlobs(str: string, env?: Object): Array {\r\n const result = parse(str, env);\r\n for (let i = 0; i < result.length; i++) {\r\n if (typeof result[i] !== 'string') {\r\n if (result[i].op === 'glob') {\r\n result[i] = result[i].pattern;\r\n } else if (result[i].op != null) {\r\n throw new Error(\r\n `Unexpected operator \"${result[i].op}\" provided to shellParse`,\r\n );\r\n } else {\r\n throw new Error(\r\n `Unexpected comment \"${result[i].comment}\" provided to shellParse`,\r\n );\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Technically you can pass in { operator: string } here,\r\n * but we don't use that in most APIs.\r\n */\r\nexport function shellQuote(args: Array): string {\r\n return quote(args);\r\n}\r\n\r\nexport function removeCommonPrefix(a: string, b: string): [string, string] {\r\n let i = 0;\r\n while (a[i] === b[i] && i < a.length && i < b.length) {\r\n i++;\r\n }\r\n return [a.substring(i), b.substring(i)];\r\n}\r\n\r\nexport function removeCommonSuffix(a: string, b: string): [string, string] {\r\n let i = 0;\r\n while (\r\n a[a.length - 1 - i] === b[b.length - 1 - i] &&\r\n i < a.length &&\r\n i < b.length\r\n ) {\r\n i++;\r\n }\r\n return [a.substring(0, a.length - i), b.substring(0, b.length - i)];\r\n}\r\n\r\nexport function shorten(\r\n str: string,\r\n maxLength: number,\r\n suffix?: string,\r\n): string {\r\n return str.length < maxLength\r\n ? str\r\n : str.slice(0, maxLength) + (suffix || '');\r\n}\r\n\r\n/**\r\n * Like String.split, but only splits once.\r\n */\r\nexport function splitOnce(str: string, separator: string): [string, ?string] {\r\n const index = str.indexOf(separator);\r\n return index === -1\r\n ? [str, null]\r\n : [str.slice(0, index), str.slice(index + separator.length)];\r\n}\r\n\r\n/**\r\n * Indents each line by the specified number of characters.\r\n */\r\nexport function indent(\r\n str: string,\r\n level: number = 2,\r\n char: string = ' ',\r\n): string {\r\n return str.replace(/^([^\\n])/gm, char.repeat(level) + '$1');\r\n}\r\n\r\nexport function pluralize(noun: string, count: number) {\r\n return count === 1 ? noun : noun + 's';\r\n}\r\n\r\nexport function capitalize(str: string): string {\r\n return str.length === 0\r\n ? str\r\n : str\r\n .charAt(0)\r\n .toUpperCase()\r\n .concat(str.slice(1));\r\n}\r\n\r\ntype MatchRange = [/* start */ number, /* end */ number];\r\n\r\n/**\r\n * Returns a list of ranges where needle occurs in haystack.\r\n * This will *not* return overlapping matches; i.e. the returned list will be disjoint.\r\n * This makes it easier to use for e.g. highlighting matches in a UI.\r\n */\r\nexport function getMatchRanges(\r\n haystack: string,\r\n needle: string,\r\n): Array {\r\n if (needle === '') {\r\n // Not really a valid use.\r\n return [];\r\n }\r\n\r\n const ranges = [];\r\n let matchIndex = 0;\r\n while ((matchIndex = haystack.indexOf(needle, matchIndex)) !== -1) {\r\n const prevRange = ranges[ranges.length - 1];\r\n if (prevRange != null && prevRange[1] === matchIndex) {\r\n prevRange[1] += needle.length;\r\n } else {\r\n ranges.push([matchIndex, matchIndex + needle.length]);\r\n }\r\n matchIndex += needle.length;\r\n }\r\n return ranges;\r\n}\r\n\r\nexport function escapeMarkdown(markdown: string): string {\r\n // Which characters can be backslash-escaped?\r\n // markdown: ! # ()*+ -. [\\] _`{ } https://daringfireball.net/projects/markdown/syntax#backslash\r\n // commonMark: !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ https://spec.commonmark.org/0.28/#backslash-escapes\r\n // We'll only backslash-escape the lowest common denominator.\r\n const slashEscaped = markdown.replace(/[#!()*+\\-.[\\\\\\]_`{}]/g, '\\\\$&');\r\n // And HTML tags need to be < > escaped.\r\n return slashEscaped.replace(//g, '>');\r\n}\r\n\r\n// Originally copied from:\r\n// http://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url\r\n// But adopted to match `www.` urls as well as `https?` urls\r\n// and `!` as acceptable url piece.\r\n// Then optimized with https://www.npmjs.com/package/regexp-tree.\r\n// Added a single matching group for use with String.split.\r\n// eslint-disable-next-line max-len\r\nexport const URL_REGEX = /(https?:\\/\\/(?:www\\.)?[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b[-\\w@:%+.~#?&/=!]*|www\\.[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b[-\\w@:%+.~#?&/=!]*)/;\r\n\r\nexport const ELLIPSIS_CHAR = '\\u2026';\r\nexport const ZERO_WIDTH_SPACE = '\\u200B';\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow strict-local\r\n * @format\r\n */\r\n\r\n// NuclideUri's are either a local file path, or a URI\r\n// of the form nuclide://\r\n//\r\n// This package creates, queries and decomposes NuclideUris.\r\n\r\nimport LspUri from 'vscode-uri';\r\n\r\nexport type NuclideUri = string;\r\n\r\ntype ParsedUrl = {\r\n hostname: ?string,\r\n path: string,\r\n};\r\n\r\ntype ParsedRemoteUrl = {\r\n hostname: string,\r\n path: string,\r\n};\r\n\r\ntype ParsedPath = {\r\n root: string,\r\n dir: string,\r\n base: string,\r\n ext: string,\r\n name: string,\r\n};\r\n\r\nimport invariant from 'assert';\r\n// eslint-disable-next-line nuclide-internal/prefer-nuclide-uri\r\nimport pathModule from 'path';\r\n\r\nimport os from 'os';\r\nimport {maybeToString} from './string';\r\n\r\nconst ARCHIVE_SEPARATOR = '!';\r\nconst KNOWN_ARCHIVE_EXTENSIONS = [];\r\n\r\nconst REMOTE_PATH_URI_PREFIX = 'nuclide://';\r\n// TODO(ljw): following regex is incorrect. A URI scheme must start with\r\n// [A-Za-z] not [0-9_-]. Also, not all schemes require // after them.\r\nconst URI_PREFIX_REGEX = /^[A-Za-z0-9_-]+:\\/\\/.*/;\r\n\r\nfunction isRemote(uri: NuclideUri): boolean {\r\n return uri.startsWith(REMOTE_PATH_URI_PREFIX);\r\n}\r\n\r\n// Atom often puts its URIs in places where we'd expect to see Nuclide URIs (or plain paths)\r\nfunction isAtomUri(uri: NuclideUri): boolean {\r\n return uri.startsWith('atom://');\r\n}\r\n\r\nfunction isUri(uri: string): boolean {\r\n return URI_PREFIX_REGEX.test(uri);\r\n}\r\n\r\nfunction isLocal(uri: NuclideUri): boolean {\r\n return !isRemote(uri) && !isUri(uri) && !isAtomUri(uri);\r\n}\r\n\r\nfunction createRemoteUri(hostname: string, remotePath: string): string {\r\n invariant(\r\n remotePath != null && remotePath !== '',\r\n 'NuclideUri must include a path.',\r\n );\r\n return `nuclide://${hostname}${remotePath}`;\r\n}\r\n\r\nfunction isInArchive(uri: NuclideUri): boolean {\r\n if (isAtomUri(uri) || uri.indexOf(ARCHIVE_SEPARATOR) < 0) {\r\n return false;\r\n }\r\n for (\r\n let i = uri.indexOf(ARCHIVE_SEPARATOR);\r\n i >= 0;\r\n i = uri.indexOf(ARCHIVE_SEPARATOR, i + 1)\r\n ) {\r\n if (_isArchiveSeparator(uri, i)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction ancestorOutsideArchive(uri: NuclideUri): NuclideUri {\r\n for (\r\n let i = uri.indexOf(ARCHIVE_SEPARATOR);\r\n i >= 0;\r\n i = uri.indexOf(ARCHIVE_SEPARATOR, i + 1)\r\n ) {\r\n if (_isArchiveSeparator(uri, i)) {\r\n return uri.substring(0, i);\r\n }\r\n }\r\n return uri;\r\n}\r\n\r\n/**\r\n * Parses valid Nuclide URIs into the hostname and path components.\r\n * Throws an Error on invalid URIs. Invalid URIs are:\r\n * 1) Any URI that does not start with 'nuclide://' protocol.\r\n * 2) A URI starting with 'nuclide://' that doesn't contain either a hostname or a path\r\n *\r\n * Everything that does not contain a '://' is assumed to be a local path. Both POSIX and Windows\r\n * paths are legal\r\n */\r\nfunction parse(uri: NuclideUri): ParsedUrl {\r\n if (uri.startsWith(REMOTE_PATH_URI_PREFIX)) {\r\n const hostAndPath = uri.substr(REMOTE_PATH_URI_PREFIX.length);\r\n const hostSep = hostAndPath.indexOf('/');\r\n\r\n invariant(\r\n hostSep !== -1,\r\n `Remote URIs must contain a hostname and a path. Failed to parse ${uri}`,\r\n );\r\n\r\n const hostname = hostAndPath.substr(0, hostSep);\r\n invariant(\r\n hostname !== '',\r\n `Remote URIs must contain a hostname. Failed to parse ${uri}`,\r\n );\r\n\r\n const path = hostAndPath.substr(hostSep);\r\n invariant(\r\n !_endsWithArchiveSeparator(uri),\r\n `Path cannot end with archive separator. Failed to parse ${uri}`,\r\n );\r\n return {hostname, path};\r\n }\r\n\r\n invariant(\r\n !_endsWithArchiveSeparator(uri),\r\n `Path cannot end with archive separator. Failed to parse ${uri}`,\r\n );\r\n return {hostname: null, path: uri};\r\n}\r\n\r\nfunction parseRemoteUri(remoteUri: NuclideUri): ParsedRemoteUrl {\r\n if (!isRemote(remoteUri)) {\r\n throw new Error('Expected remote uri. Got ' + remoteUri);\r\n }\r\n const parsedUri = parse(remoteUri);\r\n invariant(\r\n // flowlint-next-line sketchy-null-string:off\r\n parsedUri.hostname,\r\n `Remote Nuclide URIs must contain hostnames, '${maybeToString(\r\n parsedUri.hostname,\r\n )}' found while parsing '${remoteUri}'`,\r\n );\r\n\r\n // Explicitly copying object properties appeases Flow's \"maybe\" type handling. Using the `...`\r\n // operator causes null/undefined errors, and `Object.assign` bypasses type checking.\r\n return {\r\n hostname: parsedUri.hostname,\r\n path: parsedUri.path,\r\n };\r\n}\r\n\r\nfunction getPath(uri: NuclideUri): string {\r\n return parse(uri).path;\r\n}\r\n\r\nfunction getHostname(remoteUri: NuclideUri): string {\r\n return parseRemoteUri(remoteUri).hostname;\r\n}\r\n\r\nfunction getHostnameOpt(remoteUri: ?NuclideUri): ?string {\r\n if (remoteUri == null || !isRemote(remoteUri)) {\r\n return null;\r\n }\r\n\r\n return getHostname(remoteUri);\r\n}\r\n\r\nfunction join(uri: NuclideUri, ...relativePath: Array): NuclideUri {\r\n return joinArray(uri, relativePath);\r\n}\r\n\r\nfunction joinArray(uri: NuclideUri, relativePath: Array): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n relativePath.splice(0, 0, path);\r\n _archiveEncodeArrayInPlace(uriPathModule, relativePath);\r\n return _archiveDecode(\r\n uriPathModule,\r\n createRemoteUri(hostname, uriPathModule.join.apply(null, relativePath)),\r\n );\r\n } else {\r\n relativePath.splice(0, 0, uri);\r\n _archiveEncodeArrayInPlace(uriPathModule, relativePath);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.join.apply(null, relativePath),\r\n );\r\n }\r\n}\r\n\r\nfunction archiveJoin(uri: NuclideUri, path: string): NuclideUri {\r\n _testForIllegalUri(uri);\r\n if (!KNOWN_ARCHIVE_EXTENSIONS.some(ext => uri.endsWith(ext))) {\r\n throw new Error(`Cannot archiveJoin with non-archive ${uri} and ${path}`);\r\n }\r\n return uri + ARCHIVE_SEPARATOR + path;\r\n}\r\n\r\nfunction normalize(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n const normal = _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.normalize(_archiveEncode(uriPathModule, path)),\r\n );\r\n return createRemoteUri(hostname, normal);\r\n } else {\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.normalize(_archiveEncode(uriPathModule, uri)),\r\n );\r\n }\r\n}\r\n\r\nfunction normalizeDir(uri: NuclideUri): NuclideUri {\r\n return ensureTrailingSeparator(normalize(uri));\r\n}\r\n\r\nfunction getParent(uri: NuclideUri): NuclideUri {\r\n // TODO: Is this different than dirname?\r\n return normalize(join(uri, '..'));\r\n}\r\n\r\nfunction relative(uri: NuclideUri, other: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n const remote = isRemote(uri);\r\n if (\r\n remote !== isRemote(other) ||\r\n (remote && getHostname(uri) !== getHostname(other))\r\n ) {\r\n throw new Error(\r\n `Cannot relative urls on different hosts: ${uri} and ${other}`,\r\n );\r\n }\r\n const uriEncode = _archiveEncode(uriPathModule, remote ? getPath(uri) : uri);\r\n const otherEncode = _archiveEncode(\r\n uriPathModule,\r\n remote ? getPath(other) : other,\r\n );\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.relative(\r\n _matchTrailingArchive(uriEncode, otherEncode),\r\n _matchTrailingArchive(otherEncode, uriEncode),\r\n ),\r\n );\r\n}\r\n\r\nfunction basename(uri: NuclideUri, ext: string = ''): string {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.basename(_archiveEncode(uriPathModule, getPath(uri)), ext),\r\n );\r\n}\r\n\r\nfunction dirname(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n return createRemoteUri(\r\n hostname,\r\n _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.dirname(_archiveEncode(uriPathModule, path)),\r\n ),\r\n );\r\n } else {\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.dirname(_archiveEncode(uriPathModule, uri)),\r\n );\r\n }\r\n}\r\n\r\nfunction extname(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.extname(_archiveEncode(uriPathModule, getPath(uri))),\r\n );\r\n}\r\n\r\nfunction stripExtension(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const ext = extname(uri);\r\n if (ext.length === 0) {\r\n return uri;\r\n }\r\n\r\n return uri.slice(0, -1 * ext.length);\r\n}\r\n\r\nfunction _isWindowsPath(path: string): boolean {\r\n return _pathModuleFor(path) === pathModule.win32;\r\n}\r\n\r\nfunction _getWindowsPathFromWindowsFileUri(uri: string): ?string {\r\n const prefix = 'file://';\r\n if (!uri.startsWith(prefix)) {\r\n return null;\r\n }\r\n\r\n const path = uri.substr(prefix.length);\r\n return _isWindowsPath(path) ? path : null;\r\n}\r\n\r\n/**\r\n * uri is either a file: uri, or a nuclide: uri.\r\n * must convert file: uri's to just a path for atom.\r\n *\r\n * Returns null if not a valid file: URI.\r\n */\r\nfunction uriToNuclideUri(uri: string): ?string {\r\n // file:// URIs should never normally contain Windows backslashes:\r\n // e.g. vscode-uri escapes C:\\abc to file:///c:/abc.\r\n // This just handles any hacky users that simply prepended 'file://'.\r\n // (vscode-uri does not know how to handle file://C:\\abc.)\r\n const windowsPathFromUri = _getWindowsPathFromWindowsFileUri(uri);\r\n if (windowsPathFromUri != null) {\r\n return windowsPathFromUri;\r\n }\r\n\r\n const lspUri = LspUri.parse(uri);\r\n if (lspUri.scheme === 'file' && lspUri.path) {\r\n // only handle real files for now.\r\n return lspUri.fsPath;\r\n } else if (isRemote(uri)) {\r\n return uri;\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Converts local paths to file: URI's. Leaves remote URI's alone.\r\n */\r\nfunction nuclideUriToUri(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n if (isRemote(uri)) {\r\n return uri;\r\n } else {\r\n return LspUri.file(uri).toString();\r\n }\r\n}\r\n\r\n/**\r\n * Returns true if child is equal to, or is a proper descendant of parent.\r\n */\r\nfunction contains(parent: NuclideUri, child: NuclideUri): boolean {\r\n _testForIllegalUri(parent);\r\n _testForIllegalUri(child);\r\n\r\n // Can't just do startsWith here. If this directory is \"www\" and you\r\n // are trying to check \"www-base\", just using startsWith would return\r\n // true, even though \"www-base\" is at the same level as \"Www\", not\r\n // contained in it.\r\n // Also, there's an issue with a trailing separator ambiguity. A path\r\n // like /abc/ does contain /abc\r\n // This function is used in some performance-sensitive parts, so we\r\n // want to avoid doing unnecessary string copy, as those that would\r\n // result from an ensureTrailingSeparator() call\r\n //\r\n // First we'll check the lengths.\r\n // Then check startsWith. If so, then if the two path lengths are\r\n // equal OR if the next character in the path to check is a path\r\n // separator, then we know the checked path is in this path.\r\n\r\n if (child.length < parent.length) {\r\n // A strong indication of false\r\n // It could be a matter of a trailing separator, though\r\n if (child.length < parent.length - 1) {\r\n // It must be more than just the separator\r\n return false;\r\n }\r\n\r\n return (\r\n parent.startsWith(child) &&\r\n (endsWithSeparator(parent) || _isArchiveSeparator(child, parent.length))\r\n );\r\n }\r\n\r\n if (!child.startsWith(parent)) {\r\n return false;\r\n }\r\n\r\n if (endsWithSeparator(parent) || parent.length === child.length) {\r\n return true;\r\n }\r\n\r\n const uriPathModule = _pathModuleFor(child);\r\n\r\n return (\r\n _isArchiveSeparator(child, parent.length) ||\r\n child.slice(parent.length).startsWith(uriPathModule.sep)\r\n );\r\n}\r\n\r\n/**\r\n * Filter an array of paths to contain only the collapsed root paths, e.g.\r\n * [a/b/c, a/, c/d/, c/d/e] collapses to [a/, c/d/]\r\n */\r\nfunction collapse(paths: Array): Array {\r\n return paths.filter(p => !paths.some(fp => contains(fp, p) && fp !== p));\r\n}\r\n\r\nconst hostFormatters = [];\r\n\r\n// A formatter which may shorten hostnames.\r\n// Returns null if the formatter won't shorten the hostname.\r\nexport type HostnameFormatter = (uri: NuclideUri) => ?string;\r\n\r\n// Registers a host formatter for nuclideUriToDisplayString\r\nfunction registerHostnameFormatter(formatter: HostnameFormatter): IDisposable {\r\n hostFormatters.push(formatter);\r\n return {\r\n dispose: () => {\r\n const index = hostFormatters.indexOf(formatter);\r\n if (index >= 0) {\r\n hostFormatters.splice(index, 1);\r\n }\r\n },\r\n };\r\n}\r\n\r\nfunction hostnameToDisplayHostname(hostname: string): string {\r\n return hostFormatters.reduce((current, formatter) => {\r\n const next = formatter(current);\r\n if (next != null && next !== '') {\r\n return next;\r\n } else {\r\n return current;\r\n }\r\n }, hostname);\r\n}\r\n\r\nfunction nuclideUriToDisplayHostname(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n return isRemote(uri) ? hostnameToDisplayHostname(getHostname(uri)) : uri;\r\n}\r\n\r\n/**\r\n * NuclideUris should never be shown to humans.\r\n * This function returns a human usable string.\r\n */\r\nfunction nuclideUriToDisplayString(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n return isRemote(uri)\r\n ? `${nuclideUriToDisplayHostname(uri)}:${getPath(uri)}`\r\n : uri;\r\n}\r\n\r\nfunction ensureTrailingSeparator(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (uri.endsWith(uriPathModule.sep)) {\r\n return uri;\r\n }\r\n\r\n return uri + uriPathModule.sep;\r\n}\r\n\r\nfunction trimTrailingSeparator(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n let stripped = uri;\r\n\r\n while (stripped.endsWith(uriPathModule.sep) && !isRoot(stripped)) {\r\n stripped = stripped.slice(0, -1 * uriPathModule.sep.length);\r\n }\r\n\r\n return stripped;\r\n}\r\n\r\nfunction endsWithSeparator(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n return uri.endsWith(uriPathModule.sep);\r\n}\r\n\r\nfunction endsWithEdenDir(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n return uri.endsWith('.eden');\r\n}\r\n\r\nfunction isAbsolute(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n if (isRemote(uri)) {\r\n return true;\r\n } else {\r\n const uriPathModule = _pathModuleFor(uri);\r\n return uriPathModule.isAbsolute(uri);\r\n }\r\n}\r\n\r\nfunction resolve(uri: NuclideUri, ...paths: Array): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n paths.splice(0, 0, path);\r\n _archiveEncodeArrayInPlace(uriPathModule, paths);\r\n return createRemoteUri(\r\n hostname,\r\n _archiveDecode(uriPathModule, uriPathModule.resolve.apply(null, paths)),\r\n );\r\n } else {\r\n paths.splice(0, 0, uri);\r\n _archiveEncodeArrayInPlace(uriPathModule, paths);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.resolve.apply(null, paths),\r\n );\r\n }\r\n}\r\n\r\nfunction isHomeRelative(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n return uri.startsWith('~');\r\n}\r\n\r\nfunction expandHomeDir(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n\r\n // Do not expand non home relative uris\r\n if (!uri.startsWith('~')) {\r\n return uri;\r\n }\r\n\r\n // \"home\" on Windows is %UserProfile%. Note that Windows environment variables\r\n // are NOT case sensitive, but process.env is a magic object that wraps GetEnvironmentVariableW\r\n // on Windows, so asking for any case is expected to work.\r\n const {HOME, UserProfile} = process.env;\r\n\r\n const isWindows = !isRemote(uri) && os.platform() === 'win32';\r\n const homePath = isWindows ? UserProfile : HOME;\r\n invariant(homePath != null);\r\n\r\n if (uri === '~') {\r\n return homePath;\r\n }\r\n\r\n // Uris like ~abc should not be expanded\r\n if (!uri.startsWith('~/') && (!isWindows || !uri.startsWith('~\\\\'))) {\r\n return uri;\r\n }\r\n\r\n return pathModule.resolve(homePath, uri.replace('~', '.'));\r\n}\r\n\r\n/**\r\n * Splits a string containing local paths by an OS-specific path delimiter\r\n * Useful for splitting env variables such as PATH\r\n *\r\n * Since remote URI might contain the delimiter, only local paths are allowed.\r\n */\r\nfunction splitPathList(paths: string): Array {\r\n invariant(\r\n paths.indexOf(REMOTE_PATH_URI_PREFIX) < 0,\r\n 'Splitting remote URIs is not supported',\r\n );\r\n const uriPathModule = _pathModuleFor(paths);\r\n\r\n return paths.split(uriPathModule.delimiter);\r\n}\r\n\r\n/**\r\n * Joins an array of local paths with an OS-specific path delimiter into a single string.\r\n * Useful for constructing env variables such as PATH\r\n *\r\n * Since remote URI might contain the delimiter, only local paths are allowed.\r\n */\r\nfunction joinPathList(paths: Array): string {\r\n if (paths.length === 0) {\r\n return '';\r\n }\r\n\r\n invariant(\r\n paths.every(path => !isRemote(path)),\r\n 'Joining of remote URIs is not supported',\r\n );\r\n\r\n const uriPathModule = _pathModuleFor(paths[0]);\r\n return paths.join(uriPathModule.delimiter);\r\n}\r\n\r\n/**\r\n * This function prepends the given relative path with a \"current-folder\" prefix\r\n * which is `./` on *nix and .\\ on Windows\r\n */\r\nfunction ensureLocalPrefix(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n\r\n invariant(!isRemote(uri), 'Local prefix can not be added to a remote path');\r\n invariant(\r\n !isAbsolute(uri),\r\n 'Local prefix can not be added to an absolute path',\r\n );\r\n\r\n const localPrefix = `.${uriPathModule.sep}`;\r\n if (uri.startsWith(localPrefix)) {\r\n return uri;\r\n }\r\n\r\n return localPrefix + uri;\r\n}\r\n\r\nfunction isRoot(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n return dirname(uri) === uri;\r\n}\r\n\r\nfunction parsePath(uri: NuclideUri): ParsedPath {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n const parsed = uriPathModule.parse(\r\n _archiveEncode(uriPathModule, getPath(uri)),\r\n );\r\n return {\r\n root: _archiveDecode(uriPathModule, parsed.root),\r\n dir: _archiveDecode(uriPathModule, parsed.dir),\r\n base: _archiveDecode(uriPathModule, parsed.base),\r\n ext: _archiveDecode(uriPathModule, parsed.ext),\r\n name: _archiveDecode(uriPathModule, parsed.name),\r\n };\r\n}\r\n\r\nfunction pathSeparatorFor(uri: NuclideUri): string {\r\n return _pathModuleFor(uri).sep;\r\n}\r\n\r\nfunction split(uri: NuclideUri): Array {\r\n const parts = [];\r\n let current = uri;\r\n let parent = dirname(current);\r\n\r\n while (current !== parent) {\r\n parts.push(basename(current));\r\n\r\n current = parent;\r\n parent = dirname(current);\r\n }\r\n\r\n if (isAbsolute(uri)) {\r\n parts.push(parent);\r\n }\r\n parts.reverse();\r\n return parts;\r\n}\r\n\r\nfunction hasKnownArchiveExtension(uri: NuclideUri): boolean {\r\n return KNOWN_ARCHIVE_EXTENSIONS.some(ext => uri.endsWith(ext));\r\n}\r\n\r\nfunction _pathModuleFor(uri: NuclideUri): typeof pathModule {\r\n invariant(\r\n !_endsWithArchiveSeparator(uri),\r\n `Path cannot end with archive separator. Failed to determine path module for ${uri}`,\r\n );\r\n if (uri.startsWith(pathModule.posix.sep)) {\r\n return pathModule.posix;\r\n }\r\n if (uri.indexOf('://') > -1) {\r\n return pathModule.posix;\r\n }\r\n if (uri[1] === ':' && uri[2] === pathModule.win32.sep) {\r\n return pathModule.win32;\r\n }\r\n\r\n // This little russian roulette here is blocking T29990593. I didn't\r\n // clean it because we might see posix paths on windows and vice versa.\r\n if (\r\n uri.split(pathModule.win32.sep).length >\r\n uri.split(pathModule.posix.sep).length\r\n ) {\r\n return pathModule.win32;\r\n } else {\r\n return pathModule.posix;\r\n }\r\n}\r\n\r\n// Runs _archiveEncode in-place on array, and returns argument for convenience.\r\nfunction _archiveEncodeArrayInPlace(\r\n uriPathModule: typeof pathModule,\r\n array: Array,\r\n): Array {\r\n array.forEach((uri, i, a) => (a[i] = _archiveEncode(uriPathModule, uri)));\r\n return array;\r\n}\r\n\r\n// This adds a native separator after every archive separator\r\n// so that the native path handling code sees them.\r\nfunction _archiveEncode(\r\n uriPathModule: typeof pathModule,\r\n uri: NuclideUri,\r\n): NuclideUri {\r\n if (uri.indexOf(ARCHIVE_SEPARATOR) < 0) {\r\n return uri;\r\n }\r\n return KNOWN_ARCHIVE_EXTENSIONS.reduce(\r\n (acc, ext) =>\r\n acc.replace(\r\n `${ext}${ARCHIVE_SEPARATOR}`,\r\n `${ext}${ARCHIVE_SEPARATOR}${uriPathModule.sep}`,\r\n ),\r\n uri,\r\n );\r\n}\r\n\r\n// This is the inverse of `encodeArchiveSeparators()` to put things\r\n// back after the native path handler has run.\r\nfunction _archiveDecode(\r\n uriPathModule: typeof pathModule,\r\n uri: NuclideUri,\r\n): NuclideUri {\r\n if (uri.indexOf(ARCHIVE_SEPARATOR) < 0) {\r\n return uri;\r\n }\r\n return _trimArchiveSuffix(\r\n KNOWN_ARCHIVE_EXTENSIONS.reduce(\r\n (acc, ext) =>\r\n acc.replace(\r\n `${ext}${ARCHIVE_SEPARATOR}${uriPathModule.sep}`,\r\n `${ext}${ARCHIVE_SEPARATOR}`,\r\n ),\r\n uri,\r\n ),\r\n );\r\n}\r\n\r\n// When working with encoded uri's, the archive separator is part of the name\r\n// so we can manipulate paths with uriPathModule. However, in `relative` if\r\n// one uri contains the other, we need the names seen by uriPathModule to agree\r\n// on whether there is an archive separator or not. E.g. if we have:\r\n// /etc/file.zip\r\n// /etc/file.zip!abc\r\n// When we encode these, we get:\r\n// /etc/file.zip\r\n// /etc/file.zip!/abc\r\n// We need to add a trailing '!' to the first one so uriPathModule can see that\r\n// the first contains the second.\r\nfunction _matchTrailingArchive(uri: string, other: string): string {\r\n if (\r\n uri.length < other.length &&\r\n other.startsWith(uri) &&\r\n _isArchiveSeparator(other, uri.length)\r\n ) {\r\n return uri + ARCHIVE_SEPARATOR;\r\n } else {\r\n return uri;\r\n }\r\n}\r\n\r\nfunction _trimArchiveSuffix(path: string): string {\r\n if (_endsWithArchiveSeparator(path)) {\r\n return path.substring(0, path.length - ARCHIVE_SEPARATOR.length);\r\n } else {\r\n return path;\r\n }\r\n}\r\n\r\nfunction _endsWithArchiveSeparator(path: string): boolean {\r\n return _isArchiveSeparator(path, path.length - 1);\r\n}\r\n\r\nfunction _isArchiveSeparator(path: string, index: number): boolean {\r\n return (\r\n path.length > index &&\r\n path.charAt(index) === ARCHIVE_SEPARATOR &&\r\n KNOWN_ARCHIVE_EXTENSIONS.some(ext => {\r\n const extStart = index - ext.length;\r\n return path.indexOf(ext, extStart) === extStart;\r\n })\r\n );\r\n}\r\n\r\nfunction _testForIllegalUri(uri: ?NuclideUri): void {\r\n if (uri != null) {\r\n if (_endsWithArchiveSeparator(uri)) {\r\n throw new Error(\r\n `Path operation invoked on URI ending with ${ARCHIVE_SEPARATOR}: ${uri}`,\r\n );\r\n }\r\n }\r\n}\r\n\r\nconst NUCLIDE_URI_TYPE_NAME = 'NuclideUri';\r\n\r\n// If mustBeRemote is present then remote-ness must match, otherwise remote-ness\r\n// is ignored.\r\nfunction validate(uri: NuclideUri, mustBeRemote?: boolean): void {\r\n // Be a little extra paranoid to catch places where the type system may be weak.\r\n invariant(uri != null, 'Unexpected null NuclideUri');\r\n invariant(\r\n typeof uri === 'string',\r\n `Unexpected NuclideUri type: ${String(uri)}`,\r\n );\r\n\r\n if (isRemote(uri)) {\r\n parse(uri);\r\n invariant(mustBeRemote !== false, 'Expected remote NuclideUri');\r\n } else {\r\n invariant(uri !== '', 'NuclideUri must contain a non-empty path');\r\n invariant(mustBeRemote !== true, 'Expected local NuclideUri');\r\n }\r\n}\r\n\r\nconst IMAGE_EXTENSIONS = new Set([\r\n '.bmp',\r\n '.gif',\r\n '.ico',\r\n '.jpeg',\r\n '.jpg',\r\n '.png',\r\n '.webp',\r\n]);\r\n\r\n/**\r\n * Returns true if this filename looks like an image that Nuclide can open; otherwise false.\r\n */\r\nfunction looksLikeImageUri(uri: NuclideUri): boolean {\r\n const ext = extname(uri).toLowerCase();\r\n return IMAGE_EXTENSIONS.has(ext);\r\n}\r\n\r\nexport default {\r\n basename,\r\n dirname,\r\n extname,\r\n stripExtension,\r\n isRemote,\r\n isLocal,\r\n createRemoteUri,\r\n isInArchive,\r\n ancestorOutsideArchive,\r\n parse,\r\n parseRemoteUri,\r\n validate,\r\n getPath,\r\n getHostname,\r\n getHostnameOpt,\r\n join,\r\n joinArray,\r\n archiveJoin,\r\n relative,\r\n looksLikeImageUri,\r\n normalize,\r\n normalizeDir,\r\n getParent,\r\n uriToNuclideUri,\r\n nuclideUriToUri,\r\n contains,\r\n collapse,\r\n nuclideUriToDisplayString,\r\n nuclideUriToDisplayHostname,\r\n hostnameToDisplayHostname,\r\n registerHostnameFormatter,\r\n ensureTrailingSeparator,\r\n trimTrailingSeparator,\r\n endsWithSeparator,\r\n endsWithEdenDir,\r\n isAbsolute,\r\n isHomeRelative,\r\n resolve,\r\n expandHomeDir,\r\n splitPathList,\r\n joinPathList,\r\n ensureLocalPrefix,\r\n isRoot,\r\n parsePath,\r\n split,\r\n pathSeparatorFor,\r\n hasKnownArchiveExtension,\r\n ARCHIVE_SEPARATOR,\r\n KNOWN_ARCHIVE_EXTENSIONS,\r\n NUCLIDE_URI_TYPE_NAME,\r\n};\r\n\r\nexport const __TEST__ = {\r\n _pathModuleFor,\r\n};\r\n","import { Range, CompositeDisposable, TextEditor, TextChange, Disposable, BufferStoppedChangingEvent } from \"atom\"\nimport type { TextEdit, BusySignalService } from \"atom-ide-base\"\nimport type {\n FileCodeFormatProvider,\n OnSaveCodeFormatProvider,\n OnTypeCodeFormatProvider,\n RangeCodeFormatProvider,\n} from \"./types\"\n\nimport { registerOnWillSave } from \"@atom-ide-community/nuclide-commons-atom/FileEventHandlers\"\nimport { getFormatOnSave, getFormatOnType } from \"./config\"\nimport { getLogger } from \"log4js\"\nimport { ProviderRegistry } from \"atom-ide-base/commons-atom/ProviderRegistry\"\nimport { applyTextEditsToBuffer } from \"@atom-ide-community/nuclide-commons-atom/text-edit\"\nimport nuclideUri from \"@atom-ide-community/nuclide-commons/nuclideUri\"\n\n// Save events are critical, so don't allow providers to block them.\nexport const SAVE_TIMEOUT = 2500\n\nexport default class CodeFormatManager {\n _subscriptions: CompositeDisposable\n _rangeProviders: ProviderRegistry\n _fileProviders: ProviderRegistry\n _onTypeProviders: ProviderRegistry\n _onSaveProviders: ProviderRegistry\n _busySignalService: BusySignalService | undefined\n\n constructor() {\n /**\n * Subscribe to all formatting events (commands, saves, edits) and dispatch formatters as necessary. By handling all\n * events in a central location, we ensure that no buffer runs into race conditions with simultaneous formatters.\n */\n this._subscriptions = new CompositeDisposable(\n // Events from the explicit Atom command.\n atom.commands.add(\"atom-text-editor\", \"code-format:format-code\", async (event) => {\n const editorElement = event.currentTarget\n const editor = editorElement.getModel()\n // Make sure we halt everything when the editor gets destroyed.\n const edits = await this._formatCodeInTextEditor(editor)\n try {\n const success = applyTextEditsToBuffer(editor.getBuffer(), edits) as boolean\n if (!success) {\n throw new Error(\"No code formatting providers found!\")\n }\n } catch (err) {\n atom.notifications.addError(`Failed to format code: ${err.message}`, {\n detail: err.detail,\n })\n }\n }),\n\n // Events from typing in the editor\n atom.workspace.observeTextEditors((editor) => {\n const onChangeSubs = editor.getBuffer().onDidStopChanging(async (event) => {\n try {\n await this._formatCodeOnTypeInTextEditor(editor, event)\n } catch (err) {\n getLogger(\"code-format\").warn(\"Failed to format code on type:\", err)\n }\n })\n // Make sure we halt everything when the editor gets destroyed.\n // We need to capture when editors are about to be destroyed in order to\n // interrupt any pending formatting operations. (Otherwise, we may end up\n // attempting to save a destroyed editor!)\n editor.onDidDestroy(() => onChangeSubs.dispose())\n }),\n\n // Format on save\n registerOnWillSave(() => ({\n priority: 0,\n timeout: SAVE_TIMEOUT,\n callback: this._formatCodeOnSaveInTextEditor.bind(this),\n }))\n )\n\n this._rangeProviders = new ProviderRegistry()\n this._fileProviders = new ProviderRegistry()\n this._onTypeProviders = new ProviderRegistry()\n this._onSaveProviders = new ProviderRegistry()\n }\n\n // Return the text edits used to format code in the editor specified.\n async _formatCodeInTextEditor(editor: TextEditor, range?: Range): Promise> {\n const buffer = editor.getBuffer()\n const selectionRange = range ?? editor.getSelectedBufferRange()\n const { start: selectionStart, end: selectionEnd } = selectionRange\n let formatRange: Range\n if (selectionRange.isEmpty()) {\n // If no selection is done, then, the whole file is wanted to be formatted.\n formatRange = buffer.getRange()\n } else {\n // Format selections should start at the beginning of the line,\n // and include the last selected line end.\n // (If the user has already selected complete rows, then depending on how they\n // did it, their caret might be either (1) at the end of their last selected line\n // or (2) at the first column of the line AFTER their selection. In both cases\n // we snap the formatRange to end at the first column of the line after their\n // selection.)\n formatRange = new Range(\n [selectionStart.row, 0],\n selectionEnd.column === 0 ? selectionEnd : [selectionEnd.row + 1, 0]\n )\n }\n const rangeProviders = [...this._rangeProviders.getAllProvidersForEditor(editor)]\n const fileProviders = [...this._fileProviders.getAllProvidersForEditor(editor)]\n const contents = editor.getText()\n\n const allEdits = await this._reportBusy(\n editor,\n Promise.all(rangeProviders.map((p) => p.formatCode(editor, formatRange)))\n )\n const rangeEdits = allEdits.filter((edits) => edits.length > 0)\n\n const allResults = await this._reportBusy(\n editor,\n Promise.all(fileProviders.map((p) => p.formatEntireFile(editor, formatRange)))\n )\n const nonNullResults = allResults.filter((result) => result !== null && result !== undefined) as {\n newCursor?: number\n formatted: string\n }[]\n const fileEdits = nonNullResults.map(({ formatted }) => [\n {\n oldRange: editor.getBuffer().getRange(),\n newText: formatted,\n oldText: contents,\n } as TextEdit,\n ])\n\n // When formatting the entire file, prefer file-based providers.\n const preferFileEdits = formatRange.isEqual(buffer.getRange())\n const edits = preferFileEdits ? fileEdits.concat(rangeEdits) : rangeEdits.concat(fileEdits)\n return edits.flat() // TODO or [0]?\n }\n\n async _formatCodeOnTypeInTextEditor(\n editor: TextEditor,\n aggregatedEvent: BufferStoppedChangingEvent\n ): Promise> {\n // Don't try to format changes with multiple cursors.\n if (aggregatedEvent.changes.length !== 1) {\n return []\n }\n const event = aggregatedEvent.changes[0]\n // This also ensures the non-emptiness of event.newText for below.\n if (!shouldFormatOnType(event) || !getFormatOnType()) {\n return []\n }\n // In the case of bracket-matching, we use the last character because that's\n // the character that will usually cause a reformat (i.e. `}` instead of `{`).\n const character = event.newText[event.newText.length - 1]\n\n const providers = [...this._onTypeProviders.getAllProvidersForEditor(editor)]\n if (providers.length === 0) {\n return []\n }\n\n const contents = editor.getText()\n const cursorPosition = editor.getCursorBufferPosition().copy()\n\n // The bracket-matching package basically overwrites\n //\n // editor.insertText('{');\n //\n // with\n //\n // editor.insertText('{}');\n // cursor.moveLeft();\n //\n // We want to wait until the cursor has actually moved before we issue a\n // format request, so that we format at the right position (and potentially\n // also let any other event handlers have their go).\n const allEdits = await Promise.all(\n providers.map((p) => p.formatAtPosition(editor, editor.getCursorBufferPosition(), character))\n )\n const firstNonEmptyIndex = allEdits.findIndex((edits) => edits.length > 0)\n if (firstNonEmptyIndex === -1) {\n return []\n } else {\n const edits = allEdits[firstNonEmptyIndex]\n const provider = providers[firstNonEmptyIndex]\n _checkContentsAreSame(contents, editor.getText())\n // Note that this modification is not in a transaction, so it applies as a\n // separate editing event than the character typing. This means that you\n // can undo just the formatting by attempting to undo once, and then undo\n // your actual code by undoing again.\n if (!applyTextEditsToBuffer(editor.getBuffer(), edits)) {\n throw new Error(\"Could not apply edits to text buffer.\")\n }\n\n if (provider.keepCursorPosition) {\n editor.setCursorBufferPosition(cursorPosition)\n }\n return edits\n }\n }\n\n async _formatCodeOnSaveInTextEditor(editor: TextEditor): Promise {\n const saveProviders = [...this._onSaveProviders.getAllProvidersForEditor(editor)]\n if (saveProviders.length > 0) {\n const allEdits = await this._reportBusy(\n editor,\n Promise.all(saveProviders.map((p) => p.formatOnSave(editor))),\n false\n )\n const edits = allEdits.filter((edits) => edits.length > 0)\n return edits.flat()\n } else if (getFormatOnSave(editor)) {\n return this._formatCodeInTextEditor(editor, editor.getBuffer().getRange())\n }\n return []\n }\n\n _reportBusy(editor: TextEditor, promise: Promise, revealTooltip: boolean = true): Promise {\n const busySignalService = this._busySignalService\n if (busySignalService !== undefined) {\n const path = editor.getPath()\n const displayPath = path !== undefined ? nuclideUri.basename(path) : \"\"\n return busySignalService.reportBusyWhile(`Formatting code in ${displayPath}`, () => promise, { revealTooltip })\n }\n return promise\n }\n\n addRangeProvider(provider: RangeCodeFormatProvider): Disposable {\n return this._rangeProviders.addProvider(provider)\n }\n\n addFileProvider(provider: FileCodeFormatProvider): Disposable {\n return this._fileProviders.addProvider(provider)\n }\n\n addOnTypeProvider(provider: OnTypeCodeFormatProvider): Disposable {\n return this._onTypeProviders.addProvider(provider)\n }\n\n addOnSaveProvider(provider: OnSaveCodeFormatProvider): Disposable {\n return this._onSaveProviders.addProvider(provider)\n }\n\n consumeBusySignal(busySignalService: BusySignalService): Disposable {\n this._busySignalService = busySignalService\n return new Disposable(() => {\n this._busySignalService = undefined\n })\n }\n\n dispose() {\n this._subscriptions.dispose()\n }\n}\n\nfunction shouldFormatOnType(event: TextChange): boolean {\n // There's not a direct way to figure out what caused this edit event. There\n // are three cases that we want to pay attention to:\n //\n // 1) The user typed a character.\n // 2) The user typed a character, and bracket-matching kicked in, causing\n // there to be two characters typed.\n // 3) The user pasted a string.\n //\n // We only want to trigger autoformatting in the first two cases. However,\n // we can only look at what new string was inserted, and not what actually\n // caused the event, so we just use some heuristics to determine which of\n // these the event probably was depending on what was typed. This means, for\n // example, we may issue spurious format requests when the user pastes a\n // single character, but this is acceptable.\n if (event.oldText !== \"\") {\n // We either just deleted something or replaced a selection. For the time\n // being, we're not going to issue a reformat in that case.\n return false\n } else if (event.newText === \"\") {\n // Not sure what happened here; why did we get an event in this case? Bail\n // for safety.\n return false\n } else if (event.newText.length > 1 && !isBracketPair(event.newText)) {\n return false\n }\n return true\n}\n\n/**\n * We can't tell the difference between a paste and the bracket-matcher package inserting an extra bracket, so we just\n * assume that any pair of brackets that bracket-matcher recognizes was a pair matched by the package.\n */\nfunction isBracketPair(typedText: string): boolean {\n if (atom.packages.getActivePackage(\"bracket-matcher\") === undefined) {\n return false\n }\n const validBracketPairs = atom.config.get(\"bracket-matcher.autocompleteCharacters\") as Array\n return validBracketPairs.includes(typedText)\n}\n\n// Checks whether contents are same in the buffer post-format, throwing if\n// anything has changed.\nfunction _checkContentsAreSame(before: string, after: string): void {\n if (before !== after) {\n throw new Error(\"The file contents were changed before formatting was complete.\")\n }\n}\n","import type { TextEditor } from \"atom\"\n\nexport function getFormatOnSave(editor: TextEditor): boolean {\n return atom.config.get(\"atom-ide-code-format.formatOnSave\", {\n scope: editor.getRootScopeDescriptor(),\n }) as boolean\n}\n\nexport function getFormatOnType(): boolean {\n return atom.config.get(\"atom-ide-code-format.formatOnType\") as boolean\n}\n","import type { Disposable } from \"atom\"\nimport type { BusySignalService } from \"atom-ide-base\"\nimport type {\n RangeCodeFormatProvider,\n FileCodeFormatProvider,\n OnTypeCodeFormatProvider,\n OnSaveCodeFormatProvider,\n} from \"./types\"\n\nimport CodeFormatManager from \"./CodeFormatManager\"\n\nexport { default as config } from \"./config.json\"\n\nlet codeFormatManager: CodeFormatManager\n\nexport function activate() {\n codeFormatManager = new CodeFormatManager()\n}\n\nexport function consumeRangeProvider(provider: RangeCodeFormatProvider): Disposable {\n return codeFormatManager.addRangeProvider(provider)\n}\n\nexport function consumeFileProvider(provider: FileCodeFormatProvider): Disposable {\n return codeFormatManager.addFileProvider(provider)\n}\n\nexport function consumeOnTypeProvider(provider: OnTypeCodeFormatProvider): Disposable {\n return codeFormatManager.addOnTypeProvider(provider)\n}\n\nexport function consumeOnSaveProvider(provider: OnSaveCodeFormatProvider): Disposable {\n return codeFormatManager.addOnSaveProvider(provider)\n}\n\nexport function consumeBusySignal(busySignalService: BusySignalService): Disposable {\n return codeFormatManager.consumeBusySignal(busySignalService)\n}\n\nexport function deactivate() {\n codeFormatManager.dispose()\n}\n\n// TODO remove\nexport { consumeLegacyProvider } from \"./legacy-provider\"\n","// TODO Remove\n\nimport type { Disposable } from \"atom\"\nimport { consumeRangeProvider, consumeFileProvider, consumeOnSaveProvider, consumeOnTypeProvider } from \"./main\"\nimport type { CodeFormatProvider } from \"./types\"\n\nexport function consumeLegacyProvider(provider: CodeFormatProvider): Disposable {\n // Legacy providers used `selector` / `inclusionPriority`.\n // @ts-ignore legacy API compatability.\n provider.grammarScopes =\n provider.grammarScopes ||\n // @ts-ignore\n (provider.selector != null ? provider.selector.split(\", \") : null)\n provider.priority =\n provider.priority != null\n ? provider.priority\n : // @ts-ignore\n provider.inclusionPriority != null\n ? // @ts-ignore\n provider.inclusionPriority\n : 0\n if (\"formatCode\" in provider) {\n return consumeRangeProvider(provider)\n } else if (\"formatEntireFile\" in provider) {\n return consumeFileProvider(provider)\n } else if (\"formatAtPosition\" in provider) {\n return consumeOnTypeProvider(provider)\n } else if (\"formatOnSave\" in provider) {\n return consumeOnSaveProvider(provider)\n }\n throw new Error(\"Invalid code format provider\")\n}\n"],"names":["functionOrClass","displayName","name","UniversalDisposable","constructor","teardowns","disposed","Set","length","add","this","Error","i","assertTeardown","addUntilDestroyed","destructible","destroyDisposable","onDidDestroy","dispose","remove","teardown","delete","forEach","unsubscribe","destroy","clear","TypeError","Promise","resolve","process","nextTick","async","promise","milliSeconds","timeoutFn","cleanupFn","timeout","setTimeout","clearTimeout","delay","Date","now","deadline","timeoutPromise","retryFunction","validationFunction","maximumTries","retryIntervalMs","result","tries","lastError","error","sleep","asyncFun","scheduledCall","pendingCall","startAsyncCall","resultPromise","then","callNext","items_","test","thisArg","items","reject","slice","numItems","next","index","item","call","f","args","apply","concat","array","filterFunction","limit","filteredList","asyncLimit","push","obj","keys","Object","filteredObj","key","someFunction","resolved","object","Boolean","fn","ret","err","ms","_lastDispatchedOp","_lastFinishedOp","_latestPromise","_waitResolve","thisOp","status","lastPromise","isRunInProgress","TimedOutError","milliseconds","String","value","catch","mappingFunction","Array","parallelPromises","parallelLimit","Math","min","runPromise","e","_promise","_state","kind","getPromise","getState","performance","seconds","nanoseconds","hrtime","rawAnalyticsService","isTrackSupported","eventName","values","track","events","subscribe","trackEvent","analyticsService","ob","setApplicationSessionObservable","event","type","data","trackSampled","sampleRate","random","sample_rate","canMeasure","TimingTracker","_eventName","_startTime","_startMark","_values","eventCount","mark","onError","_trackTimingEvent","onCancel","onSuccess","exception","canceled","measure","clearMarks","clearMeasures","duration","round","toString","startTracking","trackTiming","operation","tracker","reason","decorateTrackTiming","decoratedTrackTiming","bind","trackTimingSampled","decorateTrackTimingSampled","decoratedTrackTimingSampled","_providers","addProvider","provider","findIndex","p","priority","splice","removeProvider","indexOf","getProviderForEditor","editor","grammar","getGrammar","scopeName","findProvider","getAllProvidersForEditor","findAllProviders","grammarScopes","emitter","callback","addListener","removeListener","Observable","create","observer","path","atom","workspace","getTextEditors","getPath","buffer","getBuffer","getViewOfEditor","getScrollTop","position","scrollTop","setCursorBufferPosition","autoscroll","setScrollTop","defer","cursor","getCursors","merge","of","getBufferPosition","onDidChangePosition","map","newBufferPosition","take","textEditor","readOnlyExceptions","getElement","setAttribute","removeAttribute","enforcedSoftWrap","setSoftWrapped","onDidChangeSoftWrapped","softWrapped","isDestroyed","TextEditor","textEditorElement","bufferLineNumber","getModel","pixelPositionForBufferPosition","top","getLineHeightInPixels","clientHeight","max","focus","views","getView","file","options","center","moveCursor","activatePane","activateItem","line","column","pending","currentEditor","getActiveTextEditor","paneContainer","paneContainerForItem","activate","goToLocationInEditor","open","initialLine","initialColumn","searchAllPanes","tmp","captureStackTrace","scrollToBufferPosition","goToLocationSubject","Subject","changes","paths","from","checkpoints","all","createCheckpoint","allOkay","reduce","successSoFar","edits","get","applyTextEdits","checkPoint","revertToCheckpoint","applySortedTextEditsToBuffer","sortEdits","sortedEdits","oldRange","end","isGreaterThan","start","editsOverlap","warn","isEqual","getRange","oldText","getText","setTextViaDiff","newText","checkpoint","applyToBuffer","groupChangesSinceCheckpoint","edit","row","lineLength","lineLengthForRow","getTextInRange","setTextInRange","sort","e1","i1","e2","i2","compare","onWillSaveProviders","disposables","observeTextEditors","realSave","save","editor_","setTime","getTime","empty","providers","toArray","race","onWillSave","toPromise","uri","patchEditorSave","ProviderRegistry","ProviderRegistry_2","atom_1","v","undefined","require","exports","_encode","ch","charCodeAt","toUpperCase","encodeURIComponent2","str","encodeURIComponent","replace","encodeNoop","defineProperty","isWindows","URI","_scheme","_empty","_authority","_path","_query","_fragment","_formatted","_fsPath","isUri","thing","authority","fragment","query","scheme","prototype","enumerable","configurable","_driveLetterPath","toLowerCase","substr","with","change","_validate","parse","_parseComponents","decodeURIComponent","_slash","idx","substring","match","_regexp","exec","components","_schemePattern","_singleSlashStart","_doubleSlashStart","skipEncoding","_asFormatted","encoder","parts","m","_upperCaseDrive","lastIdx","join","toJSON","res","fsPath","external","$mid","revive","default","platform","navigator","userAgent","factory","module","xs","s","op","CONTROL","BAREWORD","TOKEN","pow","env","opts","mapped","chunker","RegExp","filter","commented","j","charAt","comment","SQ","DQ","DS","BS","escape","quote","esc","out","isGlob","len","c","parseEnvVar","pattern","varend","varname","getVar","prev","arg","_","pre","r","JSON","stringify","acc","split","x","message","stack","input_","reference_","useShortVariant","useNumbersOnly","input","reference","delta","formats","shortFormats","longFormatsNumbers","longFormats","relativeFormat","remainder","haystack","char","count","code","a","b","maxLength","suffix","separator","level","repeat","noun","needle","ranges","matchIndex","prevRange","markdown","HOUR","DAY","WEEK","YEAR","MONTH","Number","MAX_VALUE","KNOWN_ARCHIVE_EXTENSIONS","URI_PREFIX_REGEX","isRemote","startsWith","isAtomUri","createRemoteUri","hostname","remotePath","hostAndPath","hostSep","_endsWithArchiveSeparator","parseRemoteUri","remoteUri","parsedUri","getHostname","relativePath","joinArray","_testForIllegalUri","uriPathModule","_pathModuleFor","_archiveEncodeArrayInPlace","_archiveDecode","normalize","_archiveEncode","basename","ext","dirname","extname","_getWindowsPathFromWindowsFileUri","prefix","pathModule","win32","_isWindowsPath","contains","parent","child","endsWithSeparator","_isArchiveSeparator","sep","hostFormatters","hostnameToDisplayHostname","current","formatter","nuclideUriToDisplayHostname","ensureTrailingSeparator","endsWith","isAbsolute","isRoot","posix","_matchTrailingArchive","other","some","extStart","IMAGE_EXTENSIONS","stripExtension","isLocal","isInArchive","ancestorOutsideArchive","validate","mustBeRemote","getHostnameOpt","archiveJoin","relative","remote","uriEncode","otherEncode","looksLikeImageUri","has","normalizeDir","getParent","uriToNuclideUri","windowsPathFromUri","lspUri","LspUri","nuclideUriToUri","collapse","fp","nuclideUriToDisplayString","registerHostnameFormatter","trimTrailingSeparator","stripped","endsWithEdenDir","isHomeRelative","expandHomeDir","HOME","UserProfile","os","homePath","splitPathList","delimiter","joinPathList","every","ensureLocalPrefix","localPrefix","parsePath","parsed","root","dir","base","reverse","pathSeparatorFor","hasKnownArchiveExtension","ARCHIVE_SEPARATOR","NUCLIDE_URI_TYPE_NAME","__TEST__","CodeFormatManager","_subscriptions","CompositeDisposable","commands","currentTarget","_formatCodeInTextEditor","applyTextEditsToBuffer","notifications","addError","detail","onChangeSubs","onDidStopChanging","_formatCodeOnTypeInTextEditor","getLogger","registerOnWillSave","_formatCodeOnSaveInTextEditor","_rangeProviders","_fileProviders","_onTypeProviders","_onSaveProviders","range","selectionRange","getSelectedBufferRange","selectionStart","selectionEnd","formatRange","isEmpty","Range","rangeProviders","fileProviders","contents","rangeEdits","_reportBusy","formatCode","fileEdits","formatEntireFile","formatted","flat","aggregatedEvent","typedText","packages","getActivePackage","config","includes","isBracketPair","shouldFormatOnType","character","cursorPosition","getCursorBufferPosition","copy","allEdits","formatAtPosition","firstNonEmptyIndex","before","after","_checkContentsAreSame","keepCursorPosition","saveProviders","formatOnSave","scope","getRootScopeDescriptor","getFormatOnSave","revealTooltip","busySignalService","_busySignalService","displayPath","nuclideUri","reportBusyWhile","addRangeProvider","addFileProvider","addOnTypeProvider","addOnSaveProvider","consumeBusySignal","Disposable","codeFormatManager","consumeRangeProvider","consumeFileProvider","consumeOnTypeProvider","consumeOnSaveProvider","selector","inclusionPriority"],"mappings":"gaAYe,SACbA,MAGyC,iBAAhCA,EAAgBC,aACS,KAAhCD,EAAgBC,mBAETD,EAAgBC,YAClB,GAC2B,iBAAzBD,EAAgBE,MACE,KAAzBF,EAAgBE,YAETF,EAAgBE,WAGlB,sFCAM,MAAMC,EAInBC,eAAeC,QAHfC,qBACAD,sBAGOA,UAAY,IAAIE,SAChBD,UAAW,EACZD,EAAUG,aACPC,OAAOJ,GAIhBI,OAAOJ,MACDK,KAAKJ,eACD,IAAIK,MAAM,8DAEb,IAAIC,EAAI,EAAGA,EAAIP,EAAUG,OAAQI,IACpCC,EAAeR,EAAUO,SACpBP,UAAUI,IAAIJ,EAAUO,IAajCE,kBACEC,KACGV,MAEC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AArBf,EAAS8e,SAAmB9e,EAAS8e,SAASjO,MAAM,MAAQ,MAC/D7Q,EAASG,SACc,MAArBH,EAASG,SACLH,EAASG,SAEmB,MAA9BH,EAAS+e,kBAEP/e,EAAS+e,kBACT,EACF,eAAgB/e,EAClB,OAAO0e,GAAqB1e,GACvB,GAAI,qBAAsBA,EAC/B,OAAO2e,GAAoB3e,GACtB,GAAI,qBAAsBA,EAC/B,OAAO4e,GAAsB5e,GACxB,GAAI,iBAAkBA,EAC3B,OAAO6e,GAAsB7e,GAE/B,MAAM,IAAIpK,MAAM,iKDUhB6oB,GAAkBtoB"} \ No newline at end of file +{"version":3,"file":"main.js","sources":["../node_modules/atom-ide-base/src-commons-atom/ProviderRegistry.ts","../node_modules/nuclide/nuclide-commons/UniversalDisposable.js","../node_modules/nuclide/nuclide-commons/event.js","../node_modules/nuclide/nuclide-commons-atom/text-editor.js","../node_modules/nuclide/nuclide-commons-atom/go-to-location.js","../node_modules/nuclide/nuclide-commons-atom/text-edit.js","../node_modules/vscode-uri/lib/index.js","../node_modules/nuclide/nuclide-commons/_shell-quote.js","../node_modules/nuclide/nuclide-commons/string.js","../node_modules/nuclide/nuclide-commons/nuclideUri.js","../../src/CodeFormatManager.ts","../../src/config.ts","../../src/utils.ts","../../src/main.ts","../../src/legacy-provider.ts"],"sourcesContent":["import { Disposable, TextEditor } from \"atom\"\nimport { Provider as ProviderTypes, BusySignalProvider, FindReferencesProvider } from \"../types-packages/main.d\"\n\nexport class ProviderRegistry> {\n private providers: Array\n\n constructor() {\n this.providers = []\n }\n\n addProvider(provider: Provider): Disposable {\n const index = this.providers.findIndex((p) => provider.priority > p.priority)\n if (index === -1) {\n this.providers.push(provider)\n } else {\n this.providers.splice(index, 0, provider)\n }\n return new Disposable(() => {\n this.removeProvider(provider)\n })\n }\n\n removeProvider(provider: Provider): void {\n const index = this.providers.indexOf(provider)\n if (index !== -1) {\n this.providers.splice(index, 1)\n }\n }\n\n // TODO deprecate since there can be N providers.\n getProviderForEditor(editor: TextEditor): Provider | null {\n const grammar = editor.getGrammar().scopeName\n return this.findProvider(grammar)\n }\n\n // TODO create an ordering or priority aware util to prefer instead.\n getAllProvidersForEditor(editor: TextEditor): Iterable {\n const grammar = editor.getGrammar().scopeName\n return this.findAllProviders(grammar)\n }\n\n findProvider(grammar: string): Provider | null {\n for (const provider of this.findAllProviders(grammar)) {\n return provider\n }\n return null\n }\n\n /** Iterates over all providers matching the grammar, in priority order. */\n *findAllProviders(grammar: string): Iterable {\n for (const provider of this.providers) {\n if (provider.grammarScopes == null || provider.grammarScopes.indexOf(grammar) !== -1) {\n yield provider\n }\n }\n }\n}\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nexport type IDestructible = {\r\n destroy(): void,\r\n onDidDestroy(callback: () => mixed): IDisposable,\r\n};\r\n\r\nexport type AnyTeardown =\r\n | (() => mixed)\r\n | rxjs$ISubscription\r\n | IDisposable\r\n | IDestructible;\r\n\r\n/**\r\n * Like a CompositeDisposable, but in addition to Disposable instances it can\r\n * also accept plain functions and Rx subscriptions.\r\n */\r\nexport default class UniversalDisposable {\r\n disposed: boolean;\r\n teardowns: Set;\r\n\r\n constructor(...teardowns: Array) {\r\n this.teardowns = new Set();\r\n this.disposed = false;\r\n if (teardowns.length) {\r\n this.add(...teardowns);\r\n }\r\n }\r\n\r\n add(...teardowns: Array): void {\r\n if (this.disposed) {\r\n throw new Error('Cannot add to an already disposed UniversalDisposable!');\r\n }\r\n for (let i = 0; i < teardowns.length; i++) {\r\n assertTeardown(teardowns[i]);\r\n this.teardowns.add(teardowns[i]);\r\n }\r\n }\r\n\r\n /**\r\n * Adds a list of teardowns but also ties them to the lifetime of `destructible`.\r\n * When `destructible` is destroyed (or `this.dispose()` gets called, whichever comes first),\r\n * all `teardowns` provided are also disposed.\r\n *\r\n * This is a subtle pattern to get right because of two factors:\r\n * - we need to make sure that all teardowns are also removed on destroy\r\n * - we also need to ensure that we don't leak the onDidDestroy disposable\r\n */\r\n addUntilDestroyed(\r\n destructible: IDestructible,\r\n ...teardowns: Array\r\n ) {\r\n if (this.disposed) {\r\n throw new Error('Cannot add to an already disposed UniversalDisposable!');\r\n }\r\n const destroyDisposable = new UniversalDisposable(\r\n ...teardowns,\r\n destructible.onDidDestroy(() => {\r\n destroyDisposable.dispose();\r\n this.remove(destroyDisposable);\r\n }),\r\n );\r\n this.add(destroyDisposable);\r\n }\r\n\r\n remove(teardown: AnyTeardown): void {\r\n if (!this.disposed) {\r\n this.teardowns.delete(teardown);\r\n }\r\n }\r\n\r\n dispose(): void {\r\n if (!this.disposed) {\r\n this.disposed = true;\r\n this.teardowns.forEach(teardown => {\r\n if (typeof teardown.dispose === 'function') {\r\n teardown.dispose();\r\n } else if (typeof teardown.unsubscribe === 'function') {\r\n teardown.unsubscribe();\r\n } else if (typeof teardown.destroy === 'function') {\r\n teardown.destroy();\r\n } else if (typeof teardown === 'function') {\r\n teardown();\r\n }\r\n });\r\n this.teardowns = (null: any);\r\n }\r\n }\r\n\r\n unsubscribe(): void {\r\n this.dispose();\r\n }\r\n\r\n clear(): void {\r\n if (!this.disposed) {\r\n this.teardowns.clear();\r\n }\r\n }\r\n}\r\n\r\nfunction assertTeardown(teardown: AnyTeardown): void {\r\n if (\r\n typeof teardown.dispose === 'function' ||\r\n typeof teardown.unsubscribe === 'function' ||\r\n typeof teardown.destroy === 'function' ||\r\n typeof teardown === 'function'\r\n ) {\r\n return;\r\n }\r\n throw new TypeError(\r\n 'Arguments to UniversalDisposable.add must be disposable',\r\n );\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport UniversalDisposable from './UniversalDisposable';\r\nimport {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\n\r\n/**\r\n * Add an event listener an return a disposable for removing it. Note that this function assumes\r\n * node EventEmitter semantics: namely, that adding the same combination of eventName and callback\r\n * adds a second listener.\r\n */\r\nexport function attachEvent(\r\n emitter: events$EventEmitter,\r\n eventName: string,\r\n callback: Function,\r\n): IDisposable {\r\n emitter.addListener(eventName, callback);\r\n return new UniversalDisposable(() => {\r\n emitter.removeListener(eventName, callback);\r\n });\r\n}\r\n\r\ntype SubscribeCallback = (item: T) => any;\r\ntype SubscribeFunction = (\r\n callback: SubscribeCallback,\r\n) => IDisposable | (() => mixed);\r\n\r\nexport function observableFromSubscribeFunction(\r\n fn: SubscribeFunction,\r\n): Observable {\r\n return Observable.create(\r\n observer => new UniversalDisposable(fn(observer.next.bind(observer))),\r\n );\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport type {NuclideUri} from '@atom-ide-community/nuclide-commons/nuclideUri';\r\n\r\nimport invariant from 'assert';\r\nimport {TextEditor} from 'atom';\r\nimport {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\n\r\nimport {observableFromSubscribeFunction} from '@atom-ide-community/nuclide-commons/event';\r\n\r\n/**\r\n * Returns a text editor that has the given path open, or null if none exists. If there are multiple\r\n * text editors for this path, one is chosen arbitrarily.\r\n */\r\nexport function existingEditorForUri(path: NuclideUri): ?atom$TextEditor {\r\n // This isn't ideal but realistically iterating through even a few hundred editors shouldn't be a\r\n // real problem. And if you have more than a few hundred you probably have bigger problems.\r\n for (const editor of atom.workspace.getTextEditors()) {\r\n if (editor.getPath() === path) {\r\n return editor;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Returns a text editor that has the given buffer open, or null if none exists. If there are\r\n * multiple text editors for this buffer, one is chosen arbitrarily.\r\n */\r\nexport function existingEditorForBuffer(\r\n buffer: atom$TextBuffer,\r\n): ?atom$TextEditor {\r\n // This isn't ideal but realistically iterating through even a few hundred editors shouldn't be a\r\n // real problem. And if you have more than a few hundred you probably have bigger problems.\r\n for (const editor of atom.workspace.getTextEditors()) {\r\n if (editor.getBuffer() === buffer) {\r\n return editor;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport function getViewOfEditor(\r\n editor: atom$TextEditor,\r\n): atom$TextEditorElement {\r\n return atom.views.getView(editor);\r\n}\r\n\r\nexport function getScrollTop(editor: atom$TextEditor): number {\r\n return getViewOfEditor(editor).getScrollTop();\r\n}\r\n\r\nexport function setScrollTop(editor: atom$TextEditor, scrollTop: number): void {\r\n getViewOfEditor(editor).setScrollTop(scrollTop);\r\n}\r\n\r\n/**\r\n * Does a best effort to set an editor pane to a given cursor position & scroll.\r\n * Does not ensure that the current cursor position is visible.\r\n *\r\n * Can be used with editor.getCursorBufferPosition() & getScrollTop() to restore\r\n * an editors cursor and scroll.\r\n */\r\nexport function setPositionAndScroll(\r\n editor: atom$TextEditor,\r\n position: atom$Point,\r\n scrollTop: number,\r\n): void {\r\n editor.setCursorBufferPosition(position, {autoscroll: false});\r\n setScrollTop(editor, scrollTop);\r\n}\r\n\r\nexport function getCursorPositions(\r\n editor: atom$TextEditor,\r\n): Observable {\r\n return Observable.defer(() => {\r\n // This will behave strangely in the face of multiple cursors. Consider supporting multiple\r\n // cursors in the future.\r\n const cursor = editor.getCursors()[0];\r\n invariant(cursor != null);\r\n return Observable.merge(\r\n Observable.of(cursor.getBufferPosition()),\r\n observableFromSubscribeFunction(\r\n cursor.onDidChangePosition.bind(cursor),\r\n ).map(event => event.newBufferPosition),\r\n );\r\n });\r\n}\r\n\r\nexport function observeEditorDestroy(\r\n editor: atom$TextEditor,\r\n): Observable {\r\n return observableFromSubscribeFunction(editor.onDidDestroy.bind(editor))\r\n .map(event => editor)\r\n .take(1);\r\n}\r\n\r\n// Use atom readOnly attribute to set read-only state.\r\nexport function enforceReadOnlyEditor(\r\n textEditor: atom$TextEditor,\r\n readOnlyExceptions?: Array = ['append', 'setText'],\r\n): IDisposable {\r\n textEditor.getElement().setAttribute('readonly', '');\r\n return {\r\n dispose() {\r\n textEditor.getElement().removeAttribute('readonly');\r\n },\r\n };\r\n}\r\n\r\n// Turn off soft wrap setting for these editors so diffs properly align.\r\n// Some text editor register sometimes override the set soft wrapping\r\n// after mounting an editor to the workspace - here, that's watched and reset to `false`.\r\nexport function enforceSoftWrap(\r\n editor: atom$TextEditor,\r\n enforcedSoftWrap: boolean,\r\n): IDisposable {\r\n editor.setSoftWrapped(enforcedSoftWrap);\r\n return editor.onDidChangeSoftWrapped(softWrapped => {\r\n if (softWrapped !== enforcedSoftWrap) {\r\n // Reset the overridden softWrap to `false` once the operation completes.\r\n process.nextTick(() => {\r\n if (!editor.isDestroyed()) {\r\n editor.setSoftWrapped(enforcedSoftWrap);\r\n }\r\n });\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Checks if an object (typically an Atom pane) is a TextEditor.\r\n * Could be replaced with atom.workspace.isValidTextEditor,\r\n * but Flow doesn't support %checks in methods yet.\r\n */\r\nexport function isValidTextEditor(item: mixed): boolean %checks {\r\n return item instanceof TextEditor;\r\n}\r\n\r\nexport function centerScrollToBufferLine(\r\n textEditorElement: atom$TextEditorElement,\r\n bufferLineNumber: number,\r\n): void {\r\n const textEditor = textEditorElement.getModel();\r\n const pixelPositionTop = textEditorElement.pixelPositionForBufferPosition([\r\n bufferLineNumber,\r\n 0,\r\n ]).top;\r\n // Manually calculate the scroll location, instead of using\r\n // `textEditor.scrollToBufferPosition([lineNumber, 0], {center: true})`\r\n // because that API to wouldn't center the line if it was in the visible screen range.\r\n const scrollTop =\r\n pixelPositionTop +\r\n textEditor.getLineHeightInPixels() / 2 -\r\n textEditorElement.clientHeight / 2;\r\n textEditorElement.setScrollTop(Math.max(scrollTop, 1));\r\n\r\n textEditorElement.focus();\r\n\r\n textEditor.setCursorBufferPosition([bufferLineNumber, 0], {\r\n autoscroll: false,\r\n });\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow strict-local\r\n * @format\r\n */\r\n\r\nimport type {Observable} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\n\r\nimport {getLogger} from 'log4js';\r\nimport {Subject} from 'rxjs-compat/bundles/rxjs-compat.umd.min.js';\r\nimport invariant from 'assert';\r\n\r\nexport type GoToLocationOptions = {|\r\n line?: number,\r\n column?: number,\r\n center?: boolean,\r\n activateItem?: boolean,\r\n activatePane?: boolean,\r\n pending?: boolean,\r\n moveCursor?: boolean,\r\n|};\r\n\r\n/**\r\n * Opens the given file.\r\n *\r\n * Optionally include a line and column to navigate to. If a line is given, by default it will\r\n * center it in the opened text editor.\r\n *\r\n * This should be preferred over `atom.workspace.open()` in typical cases. The motivations are:\r\n * - We call `atom.workspace.open()` with the `searchAllPanes` option. This looks in other panes for\r\n * the current file, rather just opening a new copy in the current pane. People often forget this\r\n * option which typically leads to a subpar experience for people who use multiple panes.\r\n * - When moving around in the current file, `goToLocation` explicitly publishes events that the nav\r\n * stack uses.\r\n *\r\n * Currently, `atom.workspace.open()` should be used only in these cases:\r\n * - When the URI to open is not a file URI. For example, if we want to open some tool like find\r\n * references in a pane.\r\n * - When we want to open an untitled file (providing no file argument). Currently, goToLocation\r\n * requires a file to open.\r\n * - When we want to open a file as a pending pane item. Currently goToLocation cannot do this.\r\n *\r\n * In these cases, you may disable the lint rule against `atom.workspace.open` by adding the\r\n * following comment above its use:\r\n * // eslint-disable-next-line nuclide-internal/atom-apis\r\n */\r\nexport async function goToLocation(\r\n file: string,\r\n options?: ?GoToLocationOptions,\r\n): Promise {\r\n const center = options?.center ?? true;\r\n const moveCursor = options?.moveCursor ?? true;\r\n const activatePane = options?.activatePane ?? true;\r\n const activateItem = options?.activateItem;\r\n const line = options?.line;\r\n const column = options?.column;\r\n const pending = options?.pending;\r\n\r\n // Prefer going to the current editor rather than the leftmost editor.\r\n const currentEditor = atom.workspace.getActiveTextEditor();\r\n if (currentEditor != null && currentEditor.getPath() === file) {\r\n const paneContainer = atom.workspace.paneContainerForItem(currentEditor);\r\n invariant(paneContainer != null);\r\n if (activatePane) {\r\n paneContainer.activate();\r\n }\r\n if (line != null) {\r\n goToLocationInEditor(currentEditor, {\r\n line,\r\n column: column == null ? 0 : column,\r\n center,\r\n moveCursor,\r\n });\r\n } else {\r\n invariant(column == null, 'goToLocation: Cannot specify just column');\r\n }\r\n return currentEditor;\r\n } else {\r\n // Obviously, calling goToLocation isn't a viable alternative here :P\r\n // eslint-disable-next-line nuclide-internal/atom-apis\r\n const editor = await atom.workspace.open(file, {\r\n initialLine: line,\r\n initialColumn: column,\r\n searchAllPanes: true,\r\n activatePane,\r\n activateItem,\r\n pending,\r\n });\r\n // TODO(T28305560) Investigate offenders for this error\r\n if (editor == null) {\r\n const tmp = {};\r\n Error.captureStackTrace(tmp);\r\n const error = Error(`atom.workspace.open returned null on ${file}`);\r\n getLogger('goToLocation').error(error);\r\n throw error;\r\n }\r\n\r\n if (center && line != null) {\r\n editor.scrollToBufferPosition([line, column], {center: true});\r\n }\r\n return editor;\r\n }\r\n}\r\n\r\nconst goToLocationSubject = new Subject();\r\n\r\ntype GotoLocationInEditorOptions = {|\r\n line: number,\r\n column: number,\r\n center?: boolean,\r\n moveCursor?: boolean,\r\n|};\r\n\r\n// Scrolls to the given line/column at the given editor\r\n// broadcasts the editor instance on an observable (subject) available\r\n// through the getGoToLocation\r\nexport function goToLocationInEditor(\r\n editor: atom$TextEditor,\r\n options: GotoLocationInEditorOptions,\r\n): void {\r\n const center = options.center == null ? true : options.center;\r\n const moveCursor = options.moveCursor == null ? true : options.moveCursor;\r\n const {line, column} = options;\r\n\r\n if (moveCursor) {\r\n editor.setCursorBufferPosition([line, column]);\r\n }\r\n if (center) {\r\n editor.scrollToBufferPosition([line, column], {center: true});\r\n }\r\n\r\n goToLocationSubject.next(editor);\r\n}\r\n\r\nexport function observeNavigatingEditors(): Observable {\r\n return goToLocationSubject;\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow strict-local\r\n * @format\r\n */\r\n\r\nimport type {NuclideUri} from '@atom-ide-community/nuclide-commons/nuclideUri';\r\n\r\nimport invariant from 'assert';\r\nimport {getLogger} from 'log4js';\r\n\r\nimport {existingEditorForUri} from './text-editor';\r\nimport {goToLocation} from './go-to-location';\r\n\r\nexport type TextEdit = {\r\n oldRange: atom$Range,\r\n newText: string,\r\n // If included, this will be used to verify that the edit still applies cleanly.\r\n oldText?: string,\r\n};\r\n\r\n/**\r\n * Attempts to apply the given patches for multiple files. Accepts a Map as input\r\n * with file paths as keys and a corresponding array of TextEdits as values.\r\n *\r\n * It is an error to send overlapping text-edits. All text-edits describe changes\r\n * made to the initial document version. The order of the edits does not matter\r\n * as they will be sorted before they are applied.\r\n *\r\n * All changes will be applied to the buffers but not saved. If a file is not\r\n * currently open, it will be opened.\r\n *\r\n * If a change is undone (Cmd+Z), only the changes of the current\r\n * file will be undone. All of the changes for that file will be undone at once.\r\n *\r\n * Returns true if the application was successful, otherwise false. If any of\r\n * the changes fail, for ANY file, then none of the changes are applied.\r\n */\r\nexport async function applyTextEditsForMultipleFiles(\r\n changes: Map>,\r\n): Promise {\r\n const paths = Array.from(changes.keys());\r\n\r\n // NOTE: There is a race here. If the file contents change while the\r\n // editors are being opened, then the ranges of the TextEdits will be off.\r\n // However, currently this is only used to applyEdits to open files.\r\n const editors = await Promise.all(\r\n paths.map(async path => goToLocation(path)),\r\n );\r\n const checkpoints = editors.map(editor => {\r\n invariant(editor != null);\r\n const buffer = editor.getBuffer();\r\n return [buffer, buffer.createCheckpoint()];\r\n });\r\n const allOkay = paths.reduce((successSoFar, path) => {\r\n const edits = changes.get(path);\r\n return successSoFar && edits != null && applyTextEdits(path, ...edits);\r\n }, true);\r\n if (!allOkay) {\r\n checkpoints.forEach(([buffer, checkPoint]) => {\r\n buffer.revertToCheckpoint(checkPoint);\r\n return false;\r\n });\r\n }\r\n return allOkay;\r\n}\r\n\r\n/**\r\n * Attempts to apply the given patches to the given file.\r\n *\r\n * It is an error to send overlapping edits. The order of the edits does not\r\n * matter (they will be sorted before they are applied).\r\n *\r\n * The file must be currently open in Atom, and the changes will be applied to the buffer but not\r\n * saved.\r\n *\r\n * Returns true if the application was successful, otherwise false (e.g. if the oldText did not\r\n * match).\r\n */\r\nexport function applyTextEdits(\r\n path: NuclideUri,\r\n ...edits: Array\r\n): boolean {\r\n const sortedEdits = sortEdits(edits);\r\n const editor = existingEditorForUri(path);\r\n invariant(editor != null);\r\n return applySortedTextEditsToBuffer(editor.getBuffer(), sortedEdits);\r\n}\r\n\r\nexport function applyTextEditsToBuffer(\r\n buffer: atom$TextBuffer | simpleTextBuffer$TextBuffer,\r\n edits: Array,\r\n): boolean {\r\n return applySortedTextEditsToBuffer(buffer, sortEdits(edits));\r\n}\r\n\r\nfunction applySortedTextEditsToBuffer(\r\n buffer: atom$TextBuffer | simpleTextBuffer$TextBuffer,\r\n edits: Array,\r\n): boolean {\r\n // For every edit, the start of its range will be after the end of the\r\n // previous edit's range.\r\n if (editsOverlap(edits)) {\r\n getLogger('text-edit').warn(\r\n 'applyTextEdits was called with overlapping edits.',\r\n );\r\n return false;\r\n }\r\n // Special-case whole-buffer changes to minimize disruption.\r\n if (edits.length === 1 && edits[0].oldRange.isEqual(buffer.getRange())) {\r\n if (edits[0].oldText != null && edits[0].oldText !== buffer.getText()) {\r\n return false;\r\n }\r\n buffer.setTextViaDiff(edits[0].newText);\r\n return true;\r\n }\r\n\r\n const checkpoint = buffer.createCheckpoint();\r\n\r\n // Iterate through in reverse order. Edits earlier in the file can move around text later in the\r\n // file, so to avoid conflicts edits should be applied last first.\r\n for (let i = edits.length - 1; i >= 0; i--) {\r\n const edit = edits[i];\r\n const success = applyToBuffer(buffer, edit);\r\n if (!success) {\r\n buffer.revertToCheckpoint(checkpoint);\r\n return false;\r\n }\r\n }\r\n\r\n buffer.groupChangesSinceCheckpoint(checkpoint);\r\n return true;\r\n}\r\n\r\nfunction applyToBuffer(\r\n buffer: atom$TextBuffer | simpleTextBuffer$TextBuffer,\r\n edit: TextEdit,\r\n): boolean {\r\n if (edit.oldRange.start.row === edit.oldRange.end.row) {\r\n // A little extra validation when the old range spans only one line. In particular, this helps\r\n // when the old range is empty so there is no old text for us to compare against. We can at\r\n // least abort if the line isn't long enough.\r\n const lineLength = buffer.lineLengthForRow(edit.oldRange.start.row);\r\n if (edit.oldRange.end.column > lineLength) {\r\n return false;\r\n }\r\n }\r\n if (edit.oldText != null) {\r\n const currentText = buffer.getTextInRange(edit.oldRange);\r\n if (currentText !== edit.oldText) {\r\n return false;\r\n }\r\n }\r\n buffer.setTextInRange(edit.oldRange, edit.newText);\r\n return true;\r\n}\r\n\r\n// Returns whether an array of sorted TextEdits contain an overlapping range.\r\nfunction editsOverlap(sortedEdits: Array): boolean {\r\n for (let i = 0; i < sortedEdits.length - 1; i++) {\r\n if (\r\n sortedEdits[i].oldRange.end.isGreaterThan(\r\n sortedEdits[i + 1].oldRange.start,\r\n )\r\n ) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction sortEdits(edits: Array): Array {\r\n // stable sort (preserve order of edits starting in the same location)\r\n return edits\r\n .map((edit, i) => [edit, i])\r\n .sort(\r\n ([e1, i1], [e2, i2]) =>\r\n e1.oldRange.start.compare(e2.oldRange.start) ||\r\n e1.oldRange.end.compare(e2.oldRange.end) ||\r\n i1 - i2,\r\n )\r\n .map(([edit]) => edit);\r\n}\r\n","(function (factory) {\n if (typeof module === \"object\" && typeof module.exports === \"object\") {\n var v = factory(require, exports);\n if (v !== undefined) module.exports = v;\n }\n else if (typeof define === \"function\" && define.amd) {\n define([\"require\", \"exports\"], factory);\n }\n})(function (require, exports) {\n /*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n 'use strict';\n Object.defineProperty(exports, \"__esModule\", { value: true });\n function _encode(ch) {\n return '%' + ch.charCodeAt(0).toString(16).toUpperCase();\n }\n // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent\n function encodeURIComponent2(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, _encode);\n }\n function encodeNoop(str) {\n return str.replace(/[#?]/, _encode);\n }\n /**\n * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.\n * This class is a simple parser which creates the basic component paths\n * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation\n * and encoding.\n *\n * foo://example.com:8042/over/there?name=ferret#nose\n * \\_/ \\______________/\\_________/ \\_________/ \\__/\n * | | | | |\n * scheme authority path query fragment\n * | _____________________|__\n * / \\ / \\\n * urn:example:animal:ferret:nose\n *\n *\n */\n var URI = (function () {\n function URI() {\n this._scheme = URI._empty;\n this._authority = URI._empty;\n this._path = URI._empty;\n this._query = URI._empty;\n this._fragment = URI._empty;\n this._formatted = null;\n this._fsPath = null;\n }\n URI.isUri = function (thing) {\n if (thing instanceof URI) {\n return true;\n }\n if (!thing) {\n return false;\n }\n return typeof thing.authority === 'string'\n && typeof thing.fragment === 'string'\n && typeof thing.path === 'string'\n && typeof thing.query === 'string'\n && typeof thing.scheme === 'string';\n };\n Object.defineProperty(URI.prototype, \"scheme\", {\n /**\n * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.\n * The part before the first colon.\n */\n get: function () {\n return this._scheme;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"authority\", {\n /**\n * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'.\n * The part between the first double slashes and the next slash.\n */\n get: function () {\n return this._authority;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"path\", {\n /**\n * path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.\n */\n get: function () {\n return this._path;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"query\", {\n /**\n * query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.\n */\n get: function () {\n return this._query;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"fragment\", {\n /**\n * fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.\n */\n get: function () {\n return this._fragment;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(URI.prototype, \"fsPath\", {\n // ---- filesystem path -----------------------\n /**\n * Returns a string representing the corresponding file system path of this URI.\n * Will handle UNC paths and normalize windows drive letters to lower-case. Also\n * uses the platform specific path separator. Will *not* validate the path for\n * invalid characters and semantics. Will *not* look at the scheme of this URI.\n */\n get: function () {\n if (!this._fsPath) {\n var value;\n if (this._authority && this._path && this.scheme === 'file') {\n // unc path: file://shares/c$/far/boo\n value = \"//\" + this._authority + this._path;\n }\n else if (URI._driveLetterPath.test(this._path)) {\n // windows drive letter: file:///c:/far/boo\n value = this._path[1].toLowerCase() + this._path.substr(2);\n }\n else {\n // other path\n value = this._path;\n }\n if (isWindows) {\n value = value.replace(/\\//g, '\\\\');\n }\n this._fsPath = value;\n }\n return this._fsPath;\n },\n enumerable: true,\n configurable: true\n });\n // ---- modify to new -------------------------\n URI.prototype.with = function (change) {\n if (!change) {\n return this;\n }\n var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment;\n if (scheme === void 0) {\n scheme = this.scheme;\n }\n else if (scheme === null) {\n scheme = '';\n }\n if (authority === void 0) {\n authority = this.authority;\n }\n else if (authority === null) {\n authority = '';\n }\n if (path === void 0) {\n path = this.path;\n }\n else if (path === null) {\n path = '';\n }\n if (query === void 0) {\n query = this.query;\n }\n else if (query === null) {\n query = '';\n }\n if (fragment === void 0) {\n fragment = this.fragment;\n }\n else if (fragment === null) {\n fragment = '';\n }\n if (scheme === this.scheme\n && authority === this.authority\n && path === this.path\n && query === this.query\n && fragment === this.fragment) {\n return this;\n }\n var ret = new URI();\n ret._scheme = scheme;\n ret._authority = authority;\n ret._path = path;\n ret._query = query;\n ret._fragment = fragment;\n URI._validate(ret);\n return ret;\n };\n // ---- parse & validate ------------------------\n URI.parse = function (value) {\n var ret = new URI();\n var data = URI._parseComponents(value);\n ret._scheme = data.scheme;\n ret._authority = decodeURIComponent(data.authority);\n ret._path = decodeURIComponent(data.path);\n ret._query = decodeURIComponent(data.query);\n ret._fragment = decodeURIComponent(data.fragment);\n URI._validate(ret);\n return ret;\n };\n URI.file = function (path) {\n var ret = new URI();\n ret._scheme = 'file';\n // normalize to fwd-slashes on windows,\n // on other systems bwd-slaches are valid\n // filename character, eg /f\\oo/ba\\r.txt\n if (isWindows) {\n path = path.replace(/\\\\/g, URI._slash);\n }\n // check for authority as used in UNC shares\n // or use the path as given\n if (path[0] === URI._slash && path[0] === path[1]) {\n var idx = path.indexOf(URI._slash, 2);\n if (idx === -1) {\n ret._authority = path.substring(2);\n }\n else {\n ret._authority = path.substring(2, idx);\n ret._path = path.substring(idx);\n }\n }\n else {\n ret._path = path;\n }\n // Ensure that path starts with a slash\n // or that it is at least a slash\n if (ret._path[0] !== URI._slash) {\n ret._path = URI._slash + ret._path;\n }\n URI._validate(ret);\n return ret;\n };\n URI._parseComponents = function (value) {\n var ret = {\n scheme: URI._empty,\n authority: URI._empty,\n path: URI._empty,\n query: URI._empty,\n fragment: URI._empty,\n };\n var match = URI._regexp.exec(value);\n if (match) {\n ret.scheme = match[2] || ret.scheme;\n ret.authority = match[4] || ret.authority;\n ret.path = match[5] || ret.path;\n ret.query = match[7] || ret.query;\n ret.fragment = match[9] || ret.fragment;\n }\n return ret;\n };\n URI.from = function (components) {\n return new URI().with(components);\n };\n URI._validate = function (ret) {\n // scheme, https://tools.ietf.org/html/rfc3986#section-3.1\n // ALPHA *( ALPHA / DIGIT / \"+\" / \"-\" / \".\" )\n if (ret.scheme && !URI._schemePattern.test(ret.scheme)) {\n throw new Error('[UriError]: Scheme contains illegal characters.');\n }\n // path, http://tools.ietf.org/html/rfc3986#section-3.3\n // If a URI contains an authority component, then the path component\n // must either be empty or begin with a slash (\"/\") character. If a URI\n // does not contain an authority component, then the path cannot begin\n // with two slash characters (\"//\").\n if (ret.path) {\n if (ret.authority) {\n if (!URI._singleSlashStart.test(ret.path)) {\n throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash (\"/\") character');\n }\n }\n else {\n if (URI._doubleSlashStart.test(ret.path)) {\n throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters (\"//\")');\n }\n }\n }\n };\n // ---- printing/externalize ---------------------------\n /**\n *\n * @param skipEncoding Do not encode the result, default is `false`\n */\n URI.prototype.toString = function (skipEncoding) {\n if (skipEncoding === void 0) { skipEncoding = false; }\n if (!skipEncoding) {\n if (!this._formatted) {\n this._formatted = URI._asFormatted(this, false);\n }\n return this._formatted;\n }\n else {\n // we don't cache that\n return URI._asFormatted(this, true);\n }\n };\n URI._asFormatted = function (uri, skipEncoding) {\n var encoder = !skipEncoding\n ? encodeURIComponent2\n : encodeNoop;\n var parts = [];\n var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment;\n if (scheme) {\n parts.push(scheme, ':');\n }\n if (authority || scheme === 'file') {\n parts.push('//');\n }\n if (authority) {\n authority = authority.toLowerCase();\n var idx = authority.indexOf(':');\n if (idx === -1) {\n parts.push(encoder(authority));\n }\n else {\n parts.push(encoder(authority.substr(0, idx)), authority.substr(idx));\n }\n }\n if (path) {\n // lower-case windows drive letters in /C:/fff or C:/fff\n var m = URI._upperCaseDrive.exec(path);\n if (m) {\n if (m[1]) {\n path = '/' + m[2].toLowerCase() + path.substr(3); // \"/c:\".length === 3\n }\n else {\n path = m[2].toLowerCase() + path.substr(2); // // \"c:\".length === 2\n }\n }\n // encode every segement but not slashes\n // make sure that # and ? are always encoded\n // when occurring in paths - otherwise the result\n // cannot be parsed back again\n var lastIdx = 0;\n while (true) {\n var idx = path.indexOf(URI._slash, lastIdx);\n if (idx === -1) {\n parts.push(encoder(path.substring(lastIdx)));\n break;\n }\n parts.push(encoder(path.substring(lastIdx, idx)), URI._slash);\n lastIdx = idx + 1;\n }\n ;\n }\n if (query) {\n parts.push('?', encoder(query));\n }\n if (fragment) {\n parts.push('#', encoder(fragment));\n }\n return parts.join(URI._empty);\n };\n URI.prototype.toJSON = function () {\n var res = {\n fsPath: this.fsPath,\n external: this.toString(),\n $mid: 1\n };\n if (this.path) {\n res.path = this.path;\n }\n if (this.scheme) {\n res.scheme = this.scheme;\n }\n if (this.authority) {\n res.authority = this.authority;\n }\n if (this.query) {\n res.query = this.query;\n }\n if (this.fragment) {\n res.fragment = this.fragment;\n }\n return res;\n };\n URI.revive = function (data) {\n var result = new URI();\n result._scheme = data.scheme || URI._empty;\n result._authority = data.authority || URI._empty;\n result._path = data.path || URI._empty;\n result._query = data.query || URI._empty;\n result._fragment = data.fragment || URI._empty;\n result._fsPath = data.fsPath;\n result._formatted = data.external;\n URI._validate(result);\n return result;\n };\n return URI;\n }());\n URI._empty = '';\n URI._slash = '/';\n URI._regexp = /^(([^:/?#]+?):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n URI._driveLetterPath = /^\\/[a-zA-z]:/;\n URI._upperCaseDrive = /^(\\/)?([A-Z]:)/;\n URI._schemePattern = /^\\w[\\w\\d+.-]*$/;\n URI._singleSlashStart = /^\\//;\n URI._doubleSlashStart = /^\\/\\//;\n exports.default = URI;\n var isWindows;\n if (typeof process === 'object') {\n isWindows = process.platform === 'win32';\n }\n else if (typeof navigator === 'object') {\n var userAgent = navigator.userAgent;\n isWindows = userAgent.indexOf('Windows') >= 0;\n }\n});\n","/**\r\nModified from https://github.com/substack/node-shell-quote/commit/72fb5a8.\r\nIncludes https://github.com/substack/node-shell-quote/pull/29, with minor\r\nmodifications to remove the unnecessary Array polyfills.\r\n\r\nUse the typed wrappers in ./string.js to access these functions.\r\n\r\nThe MIT License\r\n\r\nCopyright (c) 2013 James Halliday (mail@substack.net)\r\n\r\nPermission is hereby granted, free of charge,\r\nto any person obtaining a copy of this software and\r\nassociated documentation files (the \"Software\"), to\r\ndeal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify,\r\nmerge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom\r\nthe Software is furnished to do so,\r\nsubject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice\r\nshall be included in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\r\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR\r\nANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n@noflow\r\n*/\r\n\r\n/* eslint-disable */\r\n\r\nexports.quote = function (xs) {\r\n return xs.map(function (s) {\r\n if (s && typeof s === 'object') {\r\n return s.op.replace(/(.)/g, '\\\\$1');\r\n }\r\n else if (/[\"\\s]/.test(s) && !/'/.test(s)) {\r\n return \"'\" + s.replace(/(['\\\\])/g, '\\\\$1') + \"'\";\r\n }\r\n else if (/[\"'\\s]/.test(s)) {\r\n return '\"' + s.replace(/([\"\\\\$`!])/g, '\\\\$1') + '\"';\r\n }\r\n else {\r\n return String(s).replace(/([#!\"$&'()*,:;<=>?@\\[\\\\\\]^`{|}])/g, '\\\\$1');\r\n }\r\n }).join(' ');\r\n};\r\n\r\nvar CONTROL = '(?:' + [\r\n '\\\\|\\\\|', '\\\\&\\\\&', ';;', '\\\\|\\\\&', '[&;()|<>]'\r\n].join('|') + ')';\r\nvar META = '|&;()<> \\\\t';\r\nvar BAREWORD = '(\\\\\\\\[\\'\"' + META + ']|[^\\\\s\\'\"' + META + '])+';\r\nvar SINGLE_QUOTE = '\"((\\\\\\\\\"|[^\"])*?)\"';\r\nvar DOUBLE_QUOTE = '\\'((\\\\\\\\\\'|[^\\'])*?)\\'';\r\n\r\nvar TOKEN = '';\r\nfor (var i = 0; i < 4; i++) {\r\n TOKEN += (Math.pow(16,8)*Math.random()).toString(16);\r\n}\r\n\r\nexports.parse = function (s, env, opts) {\r\n var mapped = parse(s, env, opts);\r\n if (typeof env !== 'function') return mapped;\r\n return mapped.reduce(function (acc, s) {\r\n if (typeof s === 'object') return acc.concat(s);\r\n var xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));\r\n if (xs.length === 1) return acc.concat(xs[0]);\r\n return acc.concat(xs.filter(Boolean).map(function (x) {\r\n if (RegExp('^' + TOKEN).test(x)) {\r\n return JSON.parse(x.split(TOKEN)[1]); }\r\n else return x;\r\n }));\r\n }, []);\r\n};\r\n\r\nfunction parse (s, env, opts) {\r\n var chunker = new RegExp([\r\n '(' + CONTROL + ')', // control chars\r\n '(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')*'\r\n ].join('|'), 'g');\r\n var match = s.match(chunker).filter(Boolean);\r\n var commented = false;\r\n\r\n if (!match) return [];\r\n if (!env) env = {};\r\n if (!opts) opts = {};\r\n return match.map(function (s, j) {\r\n if (commented) {\r\n return;\r\n }\r\n if (s.charAt(0) === '#') {\r\n commented = true;\r\n return { comment: s.substr(1) + match.slice(j+1).join(' ') };\r\n }\r\n if (RegExp('^' + CONTROL + '$').test(s)) {\r\n return { op: s };\r\n }\r\n\r\n // Hand-written scanner/parser for Bash quoting rules:\r\n //\r\n // 1. inside single quotes, all characters are printed literally.\r\n // 2. inside double quotes, all characters are printed literally\r\n // except variables prefixed by '$' and backslashes followed by\r\n // either a double quote or another backslash.\r\n // 3. outside of any quotes, backslashes are treated as escape\r\n // characters and not printed (unless they are themselves escaped)\r\n // 4. quote context can switch mid-token if there is no whitespace\r\n // between the two quote contexts (e.g. all'one'\"token\" parses as\r\n // \"allonetoken\")\r\n var SQ = \"'\";\r\n var DQ = '\"';\r\n var DS = '$';\r\n var BS = opts.escape || '\\\\';\r\n var quote = false;\r\n var esc = false;\r\n var out = '';\r\n var isGlob = false;\r\n\r\n for (var i = 0, len = s.length; i < len; i++) {\r\n var c = s.charAt(i);\r\n isGlob = isGlob || (!quote && (c === '*' || c === '?'));\r\n if (esc) {\r\n out += c;\r\n esc = false;\r\n }\r\n else if (quote) {\r\n if (c === quote) {\r\n quote = false;\r\n }\r\n else if (quote == SQ) {\r\n out += c;\r\n }\r\n else { // Double quote\r\n if (c === BS) {\r\n i += 1;\r\n c = s.charAt(i);\r\n if (c === DQ || c === BS || c === DS) {\r\n out += c;\r\n } else {\r\n out += BS + c;\r\n }\r\n }\r\n else if (c === DS) {\r\n out += parseEnvVar();\r\n }\r\n else {\r\n out += c;\r\n }\r\n }\r\n }\r\n else if (c === DQ || c === SQ) {\r\n quote = c;\r\n }\r\n else if (RegExp('^' + CONTROL + '$').test(c)) {\r\n return { op: s };\r\n }\r\n else if (c === BS) {\r\n esc = true;\r\n }\r\n else if (c === DS) {\r\n out += parseEnvVar();\r\n }\r\n else out += c;\r\n }\r\n\r\n if (isGlob) return {op: 'glob', pattern: out};\r\n\r\n return out;\r\n\r\n function parseEnvVar() {\r\n i += 1;\r\n var varend, varname;\r\n //debugger\r\n if (s.charAt(i) === '{') {\r\n i += 1;\r\n if (s.charAt(i) === '}') {\r\n throw new Error(\"Bad substitution: \" + s.substr(i - 2, 3));\r\n }\r\n varend = s.indexOf('}', i);\r\n if (varend < 0) {\r\n throw new Error(\"Bad substitution: \" + s.substr(i));\r\n }\r\n varname = s.substr(i, varend - i);\r\n i = varend;\r\n }\r\n else if (/[*@#?$!_\\-]/.test(s.charAt(i))) {\r\n varname = s.charAt(i);\r\n i += 1;\r\n }\r\n else {\r\n varend = s.substr(i).match(/[^\\w\\d_]/);\r\n if (!varend) {\r\n varname = s.substr(i);\r\n i = s.length;\r\n } else {\r\n varname = s.substr(i, varend.index);\r\n i += varend.index - 1;\r\n }\r\n }\r\n return getVar(null, '', varname);\r\n }\r\n })\r\n // finalize parsed aruments\r\n .reduce(function(prev, arg){\r\n if (arg === undefined){\r\n return prev;\r\n }\r\n return prev.concat(arg);\r\n },[]);\r\n\r\n function getVar (_, pre, key) {\r\n var r = typeof env === 'function' ? env(key) : env[key];\r\n if (r === undefined) r = '';\r\n\r\n if (typeof r === 'object') {\r\n return pre + TOKEN + JSON.stringify(r) + TOKEN;\r\n }\r\n else return pre + r;\r\n }\r\n}\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow\r\n * @format\r\n */\r\n\r\nimport invariant from 'assert';\r\nimport {parse, quote} from './_shell-quote';\r\n\r\nexport function stringifyError(error: Error): string {\r\n return `name: ${error.name}, message: ${error.message}, stack: ${\r\n error.stack\r\n }.`;\r\n}\r\n\r\n// As of Flow v0.28, Flow does not alllow implicit string coercion of null or undefined. Use this to\r\n// make it explicit.\r\nexport function maybeToString(str: ?string): string {\r\n // We don't want to encourage the use of this function directly because it coerces anything to a\r\n // string. We get stricter typechecking by using maybeToString, so it should generally be\r\n // preferred.\r\n return String(str);\r\n}\r\n\r\n/**\r\n * Originally adapted from https://github.com/azer/relative-date.\r\n * We're including it because of https://github.com/npm/npm/issues/12012\r\n */\r\nconst SECOND = 1000;\r\nconst MINUTE = 60 * SECOND;\r\nconst HOUR = 60 * MINUTE;\r\nconst DAY = 24 * HOUR;\r\nconst WEEK = 7 * DAY;\r\nconst YEAR = DAY * 365;\r\nconst MONTH = YEAR / 12;\r\n\r\nconst shortFormats = [\r\n [0.7 * MINUTE, 'now'],\r\n [1.5 * MINUTE, '1m'],\r\n [60 * MINUTE, 'm', MINUTE],\r\n [1.5 * HOUR, '1h'],\r\n [DAY, 'h', HOUR],\r\n [2 * DAY, '1d'],\r\n [7 * DAY, 'd', DAY],\r\n [1.5 * WEEK, '1w'],\r\n [MONTH, 'w', WEEK],\r\n [1.5 * MONTH, '1mo'],\r\n [YEAR, 'mo', MONTH],\r\n [1.5 * YEAR, '1y'],\r\n [Number.MAX_VALUE, 'y', YEAR],\r\n];\r\n\r\nconst longFormats = [\r\n [0.7 * MINUTE, 'just now'],\r\n [1.5 * MINUTE, 'a minute ago'],\r\n [60 * MINUTE, 'minutes ago', MINUTE],\r\n [1.5 * HOUR, 'an hour ago'],\r\n [DAY, 'hours ago', HOUR],\r\n [2 * DAY, 'yesterday'],\r\n [7 * DAY, 'days ago', DAY],\r\n [1.5 * WEEK, 'a week ago'],\r\n [MONTH, 'weeks ago', WEEK],\r\n [1.5 * MONTH, 'a month ago'],\r\n [YEAR, 'months ago', MONTH],\r\n [1.5 * YEAR, 'a year ago'],\r\n [Number.MAX_VALUE, 'years ago', YEAR],\r\n];\r\n\r\nconst longFormatsNumbers = [\r\n [0.7 * MINUTE, 'just now'],\r\n [1.5 * MINUTE, '1 minute ago'],\r\n [60 * MINUTE, 'minutes ago', MINUTE],\r\n [1.5 * HOUR, '1 hour ago'],\r\n [DAY, 'hours ago', HOUR],\r\n [2 * DAY, 'yesterday'],\r\n [7 * DAY, 'days ago', DAY],\r\n [1.5 * WEEK, '1 week ago'],\r\n [MONTH, 'weeks ago', WEEK],\r\n [1.5 * MONTH, '1 month ago'],\r\n [YEAR, 'months ago', MONTH],\r\n [1.5 * YEAR, '1 year ago'],\r\n [Number.MAX_VALUE, 'years ago', YEAR],\r\n];\r\n\r\nexport function relativeDate(\r\n input_: number | Date,\r\n reference_?: number | Date,\r\n useShortVariant?: boolean = false,\r\n useNumbersOnly?: boolean = false,\r\n): string {\r\n let input = input_;\r\n let reference = reference_;\r\n if (input instanceof Date) {\r\n input = input.getTime();\r\n }\r\n // flowlint-next-line sketchy-null-number:off\r\n if (!reference) {\r\n reference = new Date().getTime();\r\n }\r\n if (reference instanceof Date) {\r\n reference = reference.getTime();\r\n }\r\n\r\n const delta = reference - input;\r\n const formats = useShortVariant\r\n ? shortFormats\r\n : useNumbersOnly\r\n ? longFormatsNumbers\r\n : longFormats;\r\n for (const [limit, relativeFormat, remainder] of formats) {\r\n if (delta < limit) {\r\n if (typeof remainder === 'number') {\r\n return (\r\n Math.round(delta / remainder) +\r\n (useShortVariant ? '' : ' ') +\r\n relativeFormat\r\n );\r\n } else {\r\n return relativeFormat;\r\n }\r\n }\r\n }\r\n\r\n throw new Error('This should never be reached.');\r\n}\r\n\r\n/**\r\n * Count the number of occurrences of `char` in `str`.\r\n * `char` must be a string of length 1.\r\n */\r\nexport function countOccurrences(haystack: string, char: string) {\r\n invariant(char.length === 1, 'char must be a string of length 1');\r\n\r\n let count = 0;\r\n const code = char.charCodeAt(0);\r\n for (let i = 0; i < haystack.length; i++) {\r\n if (haystack.charCodeAt(i) === code) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n}\r\n\r\n/**\r\n * shell-quote's parse allows pipe operators and comments.\r\n * Generally users don't care about this, so throw if we encounter any operators.\r\n */\r\nexport function shellParse(str: string, env?: Object): Array {\r\n const result = parse(str, env);\r\n for (let i = 0; i < result.length; i++) {\r\n if (typeof result[i] !== 'string') {\r\n if (result[i].op != null) {\r\n throw new Error(\r\n `Unexpected operator \"${result[i].op}\" provided to shellParse`,\r\n );\r\n } else {\r\n throw new Error(\r\n `Unexpected comment \"${result[i].comment}\" provided to shellParse`,\r\n );\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * shell-quote's parse allows pipe operators and comments and globs\r\n * We treat glob patterns as normal strings. For the other operators, we throw.\r\n */\r\nexport function shellParseWithGlobs(str: string, env?: Object): Array {\r\n const result = parse(str, env);\r\n for (let i = 0; i < result.length; i++) {\r\n if (typeof result[i] !== 'string') {\r\n if (result[i].op === 'glob') {\r\n result[i] = result[i].pattern;\r\n } else if (result[i].op != null) {\r\n throw new Error(\r\n `Unexpected operator \"${result[i].op}\" provided to shellParse`,\r\n );\r\n } else {\r\n throw new Error(\r\n `Unexpected comment \"${result[i].comment}\" provided to shellParse`,\r\n );\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Technically you can pass in { operator: string } here,\r\n * but we don't use that in most APIs.\r\n */\r\nexport function shellQuote(args: Array): string {\r\n return quote(args);\r\n}\r\n\r\nexport function removeCommonPrefix(a: string, b: string): [string, string] {\r\n let i = 0;\r\n while (a[i] === b[i] && i < a.length && i < b.length) {\r\n i++;\r\n }\r\n return [a.substring(i), b.substring(i)];\r\n}\r\n\r\nexport function removeCommonSuffix(a: string, b: string): [string, string] {\r\n let i = 0;\r\n while (\r\n a[a.length - 1 - i] === b[b.length - 1 - i] &&\r\n i < a.length &&\r\n i < b.length\r\n ) {\r\n i++;\r\n }\r\n return [a.substring(0, a.length - i), b.substring(0, b.length - i)];\r\n}\r\n\r\nexport function shorten(\r\n str: string,\r\n maxLength: number,\r\n suffix?: string,\r\n): string {\r\n return str.length < maxLength\r\n ? str\r\n : str.slice(0, maxLength) + (suffix || '');\r\n}\r\n\r\n/**\r\n * Like String.split, but only splits once.\r\n */\r\nexport function splitOnce(str: string, separator: string): [string, ?string] {\r\n const index = str.indexOf(separator);\r\n return index === -1\r\n ? [str, null]\r\n : [str.slice(0, index), str.slice(index + separator.length)];\r\n}\r\n\r\n/**\r\n * Indents each line by the specified number of characters.\r\n */\r\nexport function indent(\r\n str: string,\r\n level: number = 2,\r\n char: string = ' ',\r\n): string {\r\n return str.replace(/^([^\\n])/gm, char.repeat(level) + '$1');\r\n}\r\n\r\nexport function pluralize(noun: string, count: number) {\r\n return count === 1 ? noun : noun + 's';\r\n}\r\n\r\nexport function capitalize(str: string): string {\r\n return str.length === 0\r\n ? str\r\n : str\r\n .charAt(0)\r\n .toUpperCase()\r\n .concat(str.slice(1));\r\n}\r\n\r\ntype MatchRange = [/* start */ number, /* end */ number];\r\n\r\n/**\r\n * Returns a list of ranges where needle occurs in haystack.\r\n * This will *not* return overlapping matches; i.e. the returned list will be disjoint.\r\n * This makes it easier to use for e.g. highlighting matches in a UI.\r\n */\r\nexport function getMatchRanges(\r\n haystack: string,\r\n needle: string,\r\n): Array {\r\n if (needle === '') {\r\n // Not really a valid use.\r\n return [];\r\n }\r\n\r\n const ranges = [];\r\n let matchIndex = 0;\r\n while ((matchIndex = haystack.indexOf(needle, matchIndex)) !== -1) {\r\n const prevRange = ranges[ranges.length - 1];\r\n if (prevRange != null && prevRange[1] === matchIndex) {\r\n prevRange[1] += needle.length;\r\n } else {\r\n ranges.push([matchIndex, matchIndex + needle.length]);\r\n }\r\n matchIndex += needle.length;\r\n }\r\n return ranges;\r\n}\r\n\r\nexport function escapeMarkdown(markdown: string): string {\r\n // Which characters can be backslash-escaped?\r\n // markdown: ! # ()*+ -. [\\] _`{ } https://daringfireball.net/projects/markdown/syntax#backslash\r\n // commonMark: !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ https://spec.commonmark.org/0.28/#backslash-escapes\r\n // We'll only backslash-escape the lowest common denominator.\r\n const slashEscaped = markdown.replace(/[#!()*+\\-.[\\\\\\]_`{}]/g, '\\\\$&');\r\n // And HTML tags need to be < > escaped.\r\n return slashEscaped.replace(//g, '>');\r\n}\r\n\r\n// Originally copied from:\r\n// http://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url\r\n// But adopted to match `www.` urls as well as `https?` urls\r\n// and `!` as acceptable url piece.\r\n// Then optimized with https://www.npmjs.com/package/regexp-tree.\r\n// Added a single matching group for use with String.split.\r\n// eslint-disable-next-line max-len\r\nexport const URL_REGEX = /(https?:\\/\\/(?:www\\.)?[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b[-\\w@:%+.~#?&/=!]*|www\\.[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b[-\\w@:%+.~#?&/=!]*)/;\r\n\r\nexport const ELLIPSIS_CHAR = '\\u2026';\r\nexport const ZERO_WIDTH_SPACE = '\\u200B';\r\n","/**\r\n * Copyright (c) 2017-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n *\r\n * @flow strict-local\r\n * @format\r\n */\r\n\r\n// NuclideUri's are either a local file path, or a URI\r\n// of the form nuclide://\r\n//\r\n// This package creates, queries and decomposes NuclideUris.\r\n\r\nimport LspUri from 'vscode-uri';\r\n\r\nexport type NuclideUri = string;\r\n\r\ntype ParsedUrl = {\r\n hostname: ?string,\r\n path: string,\r\n};\r\n\r\ntype ParsedRemoteUrl = {\r\n hostname: string,\r\n path: string,\r\n};\r\n\r\ntype ParsedPath = {\r\n root: string,\r\n dir: string,\r\n base: string,\r\n ext: string,\r\n name: string,\r\n};\r\n\r\nimport invariant from 'assert';\r\n// eslint-disable-next-line nuclide-internal/prefer-nuclide-uri\r\nimport pathModule from 'path';\r\n\r\nimport os from 'os';\r\nimport {maybeToString} from './string';\r\n\r\nconst ARCHIVE_SEPARATOR = '!';\r\nconst KNOWN_ARCHIVE_EXTENSIONS = [];\r\n\r\nconst REMOTE_PATH_URI_PREFIX = 'nuclide://';\r\n// TODO(ljw): following regex is incorrect. A URI scheme must start with\r\n// [A-Za-z] not [0-9_-]. Also, not all schemes require // after them.\r\nconst URI_PREFIX_REGEX = /^[A-Za-z0-9_-]+:\\/\\/.*/;\r\n\r\nfunction isRemote(uri: NuclideUri): boolean {\r\n return uri.startsWith(REMOTE_PATH_URI_PREFIX);\r\n}\r\n\r\n// Atom often puts its URIs in places where we'd expect to see Nuclide URIs (or plain paths)\r\nfunction isAtomUri(uri: NuclideUri): boolean {\r\n return uri.startsWith('atom://');\r\n}\r\n\r\nfunction isUri(uri: string): boolean {\r\n return URI_PREFIX_REGEX.test(uri);\r\n}\r\n\r\nfunction isLocal(uri: NuclideUri): boolean {\r\n return !isRemote(uri) && !isUri(uri) && !isAtomUri(uri);\r\n}\r\n\r\nfunction createRemoteUri(hostname: string, remotePath: string): string {\r\n invariant(\r\n remotePath != null && remotePath !== '',\r\n 'NuclideUri must include a path.',\r\n );\r\n return `nuclide://${hostname}${remotePath}`;\r\n}\r\n\r\nfunction isInArchive(uri: NuclideUri): boolean {\r\n if (isAtomUri(uri) || uri.indexOf(ARCHIVE_SEPARATOR) < 0) {\r\n return false;\r\n }\r\n for (\r\n let i = uri.indexOf(ARCHIVE_SEPARATOR);\r\n i >= 0;\r\n i = uri.indexOf(ARCHIVE_SEPARATOR, i + 1)\r\n ) {\r\n if (_isArchiveSeparator(uri, i)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction ancestorOutsideArchive(uri: NuclideUri): NuclideUri {\r\n for (\r\n let i = uri.indexOf(ARCHIVE_SEPARATOR);\r\n i >= 0;\r\n i = uri.indexOf(ARCHIVE_SEPARATOR, i + 1)\r\n ) {\r\n if (_isArchiveSeparator(uri, i)) {\r\n return uri.substring(0, i);\r\n }\r\n }\r\n return uri;\r\n}\r\n\r\n/**\r\n * Parses valid Nuclide URIs into the hostname and path components.\r\n * Throws an Error on invalid URIs. Invalid URIs are:\r\n * 1) Any URI that does not start with 'nuclide://' protocol.\r\n * 2) A URI starting with 'nuclide://' that doesn't contain either a hostname or a path\r\n *\r\n * Everything that does not contain a '://' is assumed to be a local path. Both POSIX and Windows\r\n * paths are legal\r\n */\r\nfunction parse(uri: NuclideUri): ParsedUrl {\r\n if (uri.startsWith(REMOTE_PATH_URI_PREFIX)) {\r\n const hostAndPath = uri.substr(REMOTE_PATH_URI_PREFIX.length);\r\n const hostSep = hostAndPath.indexOf('/');\r\n\r\n invariant(\r\n hostSep !== -1,\r\n `Remote URIs must contain a hostname and a path. Failed to parse ${uri}`,\r\n );\r\n\r\n const hostname = hostAndPath.substr(0, hostSep);\r\n invariant(\r\n hostname !== '',\r\n `Remote URIs must contain a hostname. Failed to parse ${uri}`,\r\n );\r\n\r\n const path = hostAndPath.substr(hostSep);\r\n invariant(\r\n !_endsWithArchiveSeparator(uri),\r\n `Path cannot end with archive separator. Failed to parse ${uri}`,\r\n );\r\n return {hostname, path};\r\n }\r\n\r\n invariant(\r\n !_endsWithArchiveSeparator(uri),\r\n `Path cannot end with archive separator. Failed to parse ${uri}`,\r\n );\r\n return {hostname: null, path: uri};\r\n}\r\n\r\nfunction parseRemoteUri(remoteUri: NuclideUri): ParsedRemoteUrl {\r\n if (!isRemote(remoteUri)) {\r\n throw new Error('Expected remote uri. Got ' + remoteUri);\r\n }\r\n const parsedUri = parse(remoteUri);\r\n invariant(\r\n // flowlint-next-line sketchy-null-string:off\r\n parsedUri.hostname,\r\n `Remote Nuclide URIs must contain hostnames, '${maybeToString(\r\n parsedUri.hostname,\r\n )}' found while parsing '${remoteUri}'`,\r\n );\r\n\r\n // Explicitly copying object properties appeases Flow's \"maybe\" type handling. Using the `...`\r\n // operator causes null/undefined errors, and `Object.assign` bypasses type checking.\r\n return {\r\n hostname: parsedUri.hostname,\r\n path: parsedUri.path,\r\n };\r\n}\r\n\r\nfunction getPath(uri: NuclideUri): string {\r\n return parse(uri).path;\r\n}\r\n\r\nfunction getHostname(remoteUri: NuclideUri): string {\r\n return parseRemoteUri(remoteUri).hostname;\r\n}\r\n\r\nfunction getHostnameOpt(remoteUri: ?NuclideUri): ?string {\r\n if (remoteUri == null || !isRemote(remoteUri)) {\r\n return null;\r\n }\r\n\r\n return getHostname(remoteUri);\r\n}\r\n\r\nfunction join(uri: NuclideUri, ...relativePath: Array): NuclideUri {\r\n return joinArray(uri, relativePath);\r\n}\r\n\r\nfunction joinArray(uri: NuclideUri, relativePath: Array): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n relativePath.splice(0, 0, path);\r\n _archiveEncodeArrayInPlace(uriPathModule, relativePath);\r\n return _archiveDecode(\r\n uriPathModule,\r\n createRemoteUri(hostname, uriPathModule.join.apply(null, relativePath)),\r\n );\r\n } else {\r\n relativePath.splice(0, 0, uri);\r\n _archiveEncodeArrayInPlace(uriPathModule, relativePath);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.join.apply(null, relativePath),\r\n );\r\n }\r\n}\r\n\r\nfunction archiveJoin(uri: NuclideUri, path: string): NuclideUri {\r\n _testForIllegalUri(uri);\r\n if (!KNOWN_ARCHIVE_EXTENSIONS.some(ext => uri.endsWith(ext))) {\r\n throw new Error(`Cannot archiveJoin with non-archive ${uri} and ${path}`);\r\n }\r\n return uri + ARCHIVE_SEPARATOR + path;\r\n}\r\n\r\nfunction normalize(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n const normal = _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.normalize(_archiveEncode(uriPathModule, path)),\r\n );\r\n return createRemoteUri(hostname, normal);\r\n } else {\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.normalize(_archiveEncode(uriPathModule, uri)),\r\n );\r\n }\r\n}\r\n\r\nfunction normalizeDir(uri: NuclideUri): NuclideUri {\r\n return ensureTrailingSeparator(normalize(uri));\r\n}\r\n\r\nfunction getParent(uri: NuclideUri): NuclideUri {\r\n // TODO: Is this different than dirname?\r\n return normalize(join(uri, '..'));\r\n}\r\n\r\nfunction relative(uri: NuclideUri, other: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n const remote = isRemote(uri);\r\n if (\r\n remote !== isRemote(other) ||\r\n (remote && getHostname(uri) !== getHostname(other))\r\n ) {\r\n throw new Error(\r\n `Cannot relative urls on different hosts: ${uri} and ${other}`,\r\n );\r\n }\r\n const uriEncode = _archiveEncode(uriPathModule, remote ? getPath(uri) : uri);\r\n const otherEncode = _archiveEncode(\r\n uriPathModule,\r\n remote ? getPath(other) : other,\r\n );\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.relative(\r\n _matchTrailingArchive(uriEncode, otherEncode),\r\n _matchTrailingArchive(otherEncode, uriEncode),\r\n ),\r\n );\r\n}\r\n\r\nfunction basename(uri: NuclideUri, ext: string = ''): string {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.basename(_archiveEncode(uriPathModule, getPath(uri)), ext),\r\n );\r\n}\r\n\r\nfunction dirname(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n return createRemoteUri(\r\n hostname,\r\n _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.dirname(_archiveEncode(uriPathModule, path)),\r\n ),\r\n );\r\n } else {\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.dirname(_archiveEncode(uriPathModule, uri)),\r\n );\r\n }\r\n}\r\n\r\nfunction extname(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.extname(_archiveEncode(uriPathModule, getPath(uri))),\r\n );\r\n}\r\n\r\nfunction stripExtension(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const ext = extname(uri);\r\n if (ext.length === 0) {\r\n return uri;\r\n }\r\n\r\n return uri.slice(0, -1 * ext.length);\r\n}\r\n\r\nfunction _isWindowsPath(path: string): boolean {\r\n return _pathModuleFor(path) === pathModule.win32;\r\n}\r\n\r\nfunction _getWindowsPathFromWindowsFileUri(uri: string): ?string {\r\n const prefix = 'file://';\r\n if (!uri.startsWith(prefix)) {\r\n return null;\r\n }\r\n\r\n const path = uri.substr(prefix.length);\r\n return _isWindowsPath(path) ? path : null;\r\n}\r\n\r\n/**\r\n * uri is either a file: uri, or a nuclide: uri.\r\n * must convert file: uri's to just a path for atom.\r\n *\r\n * Returns null if not a valid file: URI.\r\n */\r\nfunction uriToNuclideUri(uri: string): ?string {\r\n // file:// URIs should never normally contain Windows backslashes:\r\n // e.g. vscode-uri escapes C:\\abc to file:///c:/abc.\r\n // This just handles any hacky users that simply prepended 'file://'.\r\n // (vscode-uri does not know how to handle file://C:\\abc.)\r\n const windowsPathFromUri = _getWindowsPathFromWindowsFileUri(uri);\r\n if (windowsPathFromUri != null) {\r\n return windowsPathFromUri;\r\n }\r\n\r\n const lspUri = LspUri.parse(uri);\r\n if (lspUri.scheme === 'file' && lspUri.path) {\r\n // only handle real files for now.\r\n return lspUri.fsPath;\r\n } else if (isRemote(uri)) {\r\n return uri;\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Converts local paths to file: URI's. Leaves remote URI's alone.\r\n */\r\nfunction nuclideUriToUri(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n if (isRemote(uri)) {\r\n return uri;\r\n } else {\r\n return LspUri.file(uri).toString();\r\n }\r\n}\r\n\r\n/**\r\n * Returns true if child is equal to, or is a proper descendant of parent.\r\n */\r\nfunction contains(parent: NuclideUri, child: NuclideUri): boolean {\r\n _testForIllegalUri(parent);\r\n _testForIllegalUri(child);\r\n\r\n // Can't just do startsWith here. If this directory is \"www\" and you\r\n // are trying to check \"www-base\", just using startsWith would return\r\n // true, even though \"www-base\" is at the same level as \"Www\", not\r\n // contained in it.\r\n // Also, there's an issue with a trailing separator ambiguity. A path\r\n // like /abc/ does contain /abc\r\n // This function is used in some performance-sensitive parts, so we\r\n // want to avoid doing unnecessary string copy, as those that would\r\n // result from an ensureTrailingSeparator() call\r\n //\r\n // First we'll check the lengths.\r\n // Then check startsWith. If so, then if the two path lengths are\r\n // equal OR if the next character in the path to check is a path\r\n // separator, then we know the checked path is in this path.\r\n\r\n if (child.length < parent.length) {\r\n // A strong indication of false\r\n // It could be a matter of a trailing separator, though\r\n if (child.length < parent.length - 1) {\r\n // It must be more than just the separator\r\n return false;\r\n }\r\n\r\n return (\r\n parent.startsWith(child) &&\r\n (endsWithSeparator(parent) || _isArchiveSeparator(child, parent.length))\r\n );\r\n }\r\n\r\n if (!child.startsWith(parent)) {\r\n return false;\r\n }\r\n\r\n if (endsWithSeparator(parent) || parent.length === child.length) {\r\n return true;\r\n }\r\n\r\n const uriPathModule = _pathModuleFor(child);\r\n\r\n return (\r\n _isArchiveSeparator(child, parent.length) ||\r\n child.slice(parent.length).startsWith(uriPathModule.sep)\r\n );\r\n}\r\n\r\n/**\r\n * Filter an array of paths to contain only the collapsed root paths, e.g.\r\n * [a/b/c, a/, c/d/, c/d/e] collapses to [a/, c/d/]\r\n */\r\nfunction collapse(paths: Array): Array {\r\n return paths.filter(p => !paths.some(fp => contains(fp, p) && fp !== p));\r\n}\r\n\r\nconst hostFormatters = [];\r\n\r\n// A formatter which may shorten hostnames.\r\n// Returns null if the formatter won't shorten the hostname.\r\nexport type HostnameFormatter = (uri: NuclideUri) => ?string;\r\n\r\n// Registers a host formatter for nuclideUriToDisplayString\r\nfunction registerHostnameFormatter(formatter: HostnameFormatter): IDisposable {\r\n hostFormatters.push(formatter);\r\n return {\r\n dispose: () => {\r\n const index = hostFormatters.indexOf(formatter);\r\n if (index >= 0) {\r\n hostFormatters.splice(index, 1);\r\n }\r\n },\r\n };\r\n}\r\n\r\nfunction hostnameToDisplayHostname(hostname: string): string {\r\n return hostFormatters.reduce((current, formatter) => {\r\n const next = formatter(current);\r\n if (next != null && next !== '') {\r\n return next;\r\n } else {\r\n return current;\r\n }\r\n }, hostname);\r\n}\r\n\r\nfunction nuclideUriToDisplayHostname(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n return isRemote(uri) ? hostnameToDisplayHostname(getHostname(uri)) : uri;\r\n}\r\n\r\n/**\r\n * NuclideUris should never be shown to humans.\r\n * This function returns a human usable string.\r\n */\r\nfunction nuclideUriToDisplayString(uri: NuclideUri): string {\r\n _testForIllegalUri(uri);\r\n return isRemote(uri)\r\n ? `${nuclideUriToDisplayHostname(uri)}:${getPath(uri)}`\r\n : uri;\r\n}\r\n\r\nfunction ensureTrailingSeparator(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (uri.endsWith(uriPathModule.sep)) {\r\n return uri;\r\n }\r\n\r\n return uri + uriPathModule.sep;\r\n}\r\n\r\nfunction trimTrailingSeparator(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n let stripped = uri;\r\n\r\n while (stripped.endsWith(uriPathModule.sep) && !isRoot(stripped)) {\r\n stripped = stripped.slice(0, -1 * uriPathModule.sep.length);\r\n }\r\n\r\n return stripped;\r\n}\r\n\r\nfunction endsWithSeparator(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n return uri.endsWith(uriPathModule.sep);\r\n}\r\n\r\nfunction endsWithEdenDir(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n return uri.endsWith('.eden');\r\n}\r\n\r\nfunction isAbsolute(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n if (isRemote(uri)) {\r\n return true;\r\n } else {\r\n const uriPathModule = _pathModuleFor(uri);\r\n return uriPathModule.isAbsolute(uri);\r\n }\r\n}\r\n\r\nfunction resolve(uri: NuclideUri, ...paths: Array): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n if (isRemote(uri)) {\r\n const {hostname, path} = parseRemoteUri(uri);\r\n paths.splice(0, 0, path);\r\n _archiveEncodeArrayInPlace(uriPathModule, paths);\r\n return createRemoteUri(\r\n hostname,\r\n _archiveDecode(uriPathModule, uriPathModule.resolve.apply(null, paths)),\r\n );\r\n } else {\r\n paths.splice(0, 0, uri);\r\n _archiveEncodeArrayInPlace(uriPathModule, paths);\r\n return _archiveDecode(\r\n uriPathModule,\r\n uriPathModule.resolve.apply(null, paths),\r\n );\r\n }\r\n}\r\n\r\nfunction isHomeRelative(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n return uri.startsWith('~');\r\n}\r\n\r\nfunction expandHomeDir(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n\r\n // Do not expand non home relative uris\r\n if (!uri.startsWith('~')) {\r\n return uri;\r\n }\r\n\r\n // \"home\" on Windows is %UserProfile%. Note that Windows environment variables\r\n // are NOT case sensitive, but process.env is a magic object that wraps GetEnvironmentVariableW\r\n // on Windows, so asking for any case is expected to work.\r\n const {HOME, UserProfile} = process.env;\r\n\r\n const isWindows = !isRemote(uri) && os.platform() === 'win32';\r\n const homePath = isWindows ? UserProfile : HOME;\r\n invariant(homePath != null);\r\n\r\n if (uri === '~') {\r\n return homePath;\r\n }\r\n\r\n // Uris like ~abc should not be expanded\r\n if (!uri.startsWith('~/') && (!isWindows || !uri.startsWith('~\\\\'))) {\r\n return uri;\r\n }\r\n\r\n return pathModule.resolve(homePath, uri.replace('~', '.'));\r\n}\r\n\r\n/**\r\n * Splits a string containing local paths by an OS-specific path delimiter\r\n * Useful for splitting env variables such as PATH\r\n *\r\n * Since remote URI might contain the delimiter, only local paths are allowed.\r\n */\r\nfunction splitPathList(paths: string): Array {\r\n invariant(\r\n paths.indexOf(REMOTE_PATH_URI_PREFIX) < 0,\r\n 'Splitting remote URIs is not supported',\r\n );\r\n const uriPathModule = _pathModuleFor(paths);\r\n\r\n return paths.split(uriPathModule.delimiter);\r\n}\r\n\r\n/**\r\n * Joins an array of local paths with an OS-specific path delimiter into a single string.\r\n * Useful for constructing env variables such as PATH\r\n *\r\n * Since remote URI might contain the delimiter, only local paths are allowed.\r\n */\r\nfunction joinPathList(paths: Array): string {\r\n if (paths.length === 0) {\r\n return '';\r\n }\r\n\r\n invariant(\r\n paths.every(path => !isRemote(path)),\r\n 'Joining of remote URIs is not supported',\r\n );\r\n\r\n const uriPathModule = _pathModuleFor(paths[0]);\r\n return paths.join(uriPathModule.delimiter);\r\n}\r\n\r\n/**\r\n * This function prepends the given relative path with a \"current-folder\" prefix\r\n * which is `./` on *nix and .\\ on Windows\r\n */\r\nfunction ensureLocalPrefix(uri: NuclideUri): NuclideUri {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n\r\n invariant(!isRemote(uri), 'Local prefix can not be added to a remote path');\r\n invariant(\r\n !isAbsolute(uri),\r\n 'Local prefix can not be added to an absolute path',\r\n );\r\n\r\n const localPrefix = `.${uriPathModule.sep}`;\r\n if (uri.startsWith(localPrefix)) {\r\n return uri;\r\n }\r\n\r\n return localPrefix + uri;\r\n}\r\n\r\nfunction isRoot(uri: NuclideUri): boolean {\r\n _testForIllegalUri(uri);\r\n return dirname(uri) === uri;\r\n}\r\n\r\nfunction parsePath(uri: NuclideUri): ParsedPath {\r\n _testForIllegalUri(uri);\r\n const uriPathModule = _pathModuleFor(uri);\r\n const parsed = uriPathModule.parse(\r\n _archiveEncode(uriPathModule, getPath(uri)),\r\n );\r\n return {\r\n root: _archiveDecode(uriPathModule, parsed.root),\r\n dir: _archiveDecode(uriPathModule, parsed.dir),\r\n base: _archiveDecode(uriPathModule, parsed.base),\r\n ext: _archiveDecode(uriPathModule, parsed.ext),\r\n name: _archiveDecode(uriPathModule, parsed.name),\r\n };\r\n}\r\n\r\nfunction pathSeparatorFor(uri: NuclideUri): string {\r\n return _pathModuleFor(uri).sep;\r\n}\r\n\r\nfunction split(uri: NuclideUri): Array {\r\n const parts = [];\r\n let current = uri;\r\n let parent = dirname(current);\r\n\r\n while (current !== parent) {\r\n parts.push(basename(current));\r\n\r\n current = parent;\r\n parent = dirname(current);\r\n }\r\n\r\n if (isAbsolute(uri)) {\r\n parts.push(parent);\r\n }\r\n parts.reverse();\r\n return parts;\r\n}\r\n\r\nfunction hasKnownArchiveExtension(uri: NuclideUri): boolean {\r\n return KNOWN_ARCHIVE_EXTENSIONS.some(ext => uri.endsWith(ext));\r\n}\r\n\r\nfunction _pathModuleFor(uri: NuclideUri): typeof pathModule {\r\n invariant(\r\n !_endsWithArchiveSeparator(uri),\r\n `Path cannot end with archive separator. Failed to determine path module for ${uri}`,\r\n );\r\n if (uri.startsWith(pathModule.posix.sep)) {\r\n return pathModule.posix;\r\n }\r\n if (uri.indexOf('://') > -1) {\r\n return pathModule.posix;\r\n }\r\n if (uri[1] === ':' && uri[2] === pathModule.win32.sep) {\r\n return pathModule.win32;\r\n }\r\n\r\n // This little russian roulette here is blocking T29990593. I didn't\r\n // clean it because we might see posix paths on windows and vice versa.\r\n if (\r\n uri.split(pathModule.win32.sep).length >\r\n uri.split(pathModule.posix.sep).length\r\n ) {\r\n return pathModule.win32;\r\n } else {\r\n return pathModule.posix;\r\n }\r\n}\r\n\r\n// Runs _archiveEncode in-place on array, and returns argument for convenience.\r\nfunction _archiveEncodeArrayInPlace(\r\n uriPathModule: typeof pathModule,\r\n array: Array,\r\n): Array {\r\n array.forEach((uri, i, a) => (a[i] = _archiveEncode(uriPathModule, uri)));\r\n return array;\r\n}\r\n\r\n// This adds a native separator after every archive separator\r\n// so that the native path handling code sees them.\r\nfunction _archiveEncode(\r\n uriPathModule: typeof pathModule,\r\n uri: NuclideUri,\r\n): NuclideUri {\r\n if (uri.indexOf(ARCHIVE_SEPARATOR) < 0) {\r\n return uri;\r\n }\r\n return KNOWN_ARCHIVE_EXTENSIONS.reduce(\r\n (acc, ext) =>\r\n acc.replace(\r\n `${ext}${ARCHIVE_SEPARATOR}`,\r\n `${ext}${ARCHIVE_SEPARATOR}${uriPathModule.sep}`,\r\n ),\r\n uri,\r\n );\r\n}\r\n\r\n// This is the inverse of `encodeArchiveSeparators()` to put things\r\n// back after the native path handler has run.\r\nfunction _archiveDecode(\r\n uriPathModule: typeof pathModule,\r\n uri: NuclideUri,\r\n): NuclideUri {\r\n if (uri.indexOf(ARCHIVE_SEPARATOR) < 0) {\r\n return uri;\r\n }\r\n return _trimArchiveSuffix(\r\n KNOWN_ARCHIVE_EXTENSIONS.reduce(\r\n (acc, ext) =>\r\n acc.replace(\r\n `${ext}${ARCHIVE_SEPARATOR}${uriPathModule.sep}`,\r\n `${ext}${ARCHIVE_SEPARATOR}`,\r\n ),\r\n uri,\r\n ),\r\n );\r\n}\r\n\r\n// When working with encoded uri's, the archive separator is part of the name\r\n// so we can manipulate paths with uriPathModule. However, in `relative` if\r\n// one uri contains the other, we need the names seen by uriPathModule to agree\r\n// on whether there is an archive separator or not. E.g. if we have:\r\n// /etc/file.zip\r\n// /etc/file.zip!abc\r\n// When we encode these, we get:\r\n// /etc/file.zip\r\n// /etc/file.zip!/abc\r\n// We need to add a trailing '!' to the first one so uriPathModule can see that\r\n// the first contains the second.\r\nfunction _matchTrailingArchive(uri: string, other: string): string {\r\n if (\r\n uri.length < other.length &&\r\n other.startsWith(uri) &&\r\n _isArchiveSeparator(other, uri.length)\r\n ) {\r\n return uri + ARCHIVE_SEPARATOR;\r\n } else {\r\n return uri;\r\n }\r\n}\r\n\r\nfunction _trimArchiveSuffix(path: string): string {\r\n if (_endsWithArchiveSeparator(path)) {\r\n return path.substring(0, path.length - ARCHIVE_SEPARATOR.length);\r\n } else {\r\n return path;\r\n }\r\n}\r\n\r\nfunction _endsWithArchiveSeparator(path: string): boolean {\r\n return _isArchiveSeparator(path, path.length - 1);\r\n}\r\n\r\nfunction _isArchiveSeparator(path: string, index: number): boolean {\r\n return (\r\n path.length > index &&\r\n path.charAt(index) === ARCHIVE_SEPARATOR &&\r\n KNOWN_ARCHIVE_EXTENSIONS.some(ext => {\r\n const extStart = index - ext.length;\r\n return path.indexOf(ext, extStart) === extStart;\r\n })\r\n );\r\n}\r\n\r\nfunction _testForIllegalUri(uri: ?NuclideUri): void {\r\n if (uri != null) {\r\n if (_endsWithArchiveSeparator(uri)) {\r\n throw new Error(\r\n `Path operation invoked on URI ending with ${ARCHIVE_SEPARATOR}: ${uri}`,\r\n );\r\n }\r\n }\r\n}\r\n\r\nconst NUCLIDE_URI_TYPE_NAME = 'NuclideUri';\r\n\r\n// If mustBeRemote is present then remote-ness must match, otherwise remote-ness\r\n// is ignored.\r\nfunction validate(uri: NuclideUri, mustBeRemote?: boolean): void {\r\n // Be a little extra paranoid to catch places where the type system may be weak.\r\n invariant(uri != null, 'Unexpected null NuclideUri');\r\n invariant(\r\n typeof uri === 'string',\r\n `Unexpected NuclideUri type: ${String(uri)}`,\r\n );\r\n\r\n if (isRemote(uri)) {\r\n parse(uri);\r\n invariant(mustBeRemote !== false, 'Expected remote NuclideUri');\r\n } else {\r\n invariant(uri !== '', 'NuclideUri must contain a non-empty path');\r\n invariant(mustBeRemote !== true, 'Expected local NuclideUri');\r\n }\r\n}\r\n\r\nconst IMAGE_EXTENSIONS = new Set([\r\n '.bmp',\r\n '.gif',\r\n '.ico',\r\n '.jpeg',\r\n '.jpg',\r\n '.png',\r\n '.webp',\r\n]);\r\n\r\n/**\r\n * Returns true if this filename looks like an image that Nuclide can open; otherwise false.\r\n */\r\nfunction looksLikeImageUri(uri: NuclideUri): boolean {\r\n const ext = extname(uri).toLowerCase();\r\n return IMAGE_EXTENSIONS.has(ext);\r\n}\r\n\r\nexport default {\r\n basename,\r\n dirname,\r\n extname,\r\n stripExtension,\r\n isRemote,\r\n isLocal,\r\n createRemoteUri,\r\n isInArchive,\r\n ancestorOutsideArchive,\r\n parse,\r\n parseRemoteUri,\r\n validate,\r\n getPath,\r\n getHostname,\r\n getHostnameOpt,\r\n join,\r\n joinArray,\r\n archiveJoin,\r\n relative,\r\n looksLikeImageUri,\r\n normalize,\r\n normalizeDir,\r\n getParent,\r\n uriToNuclideUri,\r\n nuclideUriToUri,\r\n contains,\r\n collapse,\r\n nuclideUriToDisplayString,\r\n nuclideUriToDisplayHostname,\r\n hostnameToDisplayHostname,\r\n registerHostnameFormatter,\r\n ensureTrailingSeparator,\r\n trimTrailingSeparator,\r\n endsWithSeparator,\r\n endsWithEdenDir,\r\n isAbsolute,\r\n isHomeRelative,\r\n resolve,\r\n expandHomeDir,\r\n splitPathList,\r\n joinPathList,\r\n ensureLocalPrefix,\r\n isRoot,\r\n parsePath,\r\n split,\r\n pathSeparatorFor,\r\n hasKnownArchiveExtension,\r\n ARCHIVE_SEPARATOR,\r\n KNOWN_ARCHIVE_EXTENSIONS,\r\n NUCLIDE_URI_TYPE_NAME,\r\n};\r\n\r\nexport const __TEST__ = {\r\n _pathModuleFor,\r\n};\r\n","import { Range, CompositeDisposable, TextEditor, TextChange, Disposable, BufferStoppedChangingEvent } from \"atom\"\nimport type { TextEdit, BusySignalService } from \"atom-ide-base\"\nimport type {\n FileCodeFormatProvider,\n OnSaveCodeFormatProvider,\n OnTypeCodeFormatProvider,\n RangeCodeFormatProvider,\n} from \"./types\"\n\nimport { getFormatOnSave, getFormatOnType } from \"./config\"\nimport { getLogger } from \"log4js\"\nimport { ProviderRegistry } from \"atom-ide-base/commons-atom/ProviderRegistry\"\nimport { applyTextEditsToBuffer } from \"@atom-ide-community/nuclide-commons-atom/text-edit\"\nimport nuclideUri from \"@atom-ide-community/nuclide-commons/nuclideUri\"\nimport { debounce } from \"./utils\"\n\n// Save events are critical, so don't allow providers to block them.\nexport const SAVE_TIMEOUT = 500\n\nexport default class CodeFormatManager {\n _subscriptions: CompositeDisposable\n _rangeProviders: ProviderRegistry\n _fileProviders: ProviderRegistry\n _onTypeProviders: ProviderRegistry\n _onSaveProviders: ProviderRegistry\n _busySignalService: BusySignalService | undefined\n\n constructor() {\n /**\n * Subscribe to all formatting events (commands, saves, edits) and dispatch formatters as necessary. By handling all\n * events in a central location, we ensure that no buffer runs into race conditions with simultaneous formatters.\n */\n this._subscriptions = new CompositeDisposable(\n // Events from the explicit Atom command.\n atom.commands.add(\"atom-text-editor\", \"code-format:format-code\", async (event) => {\n const editorElement = event.currentTarget\n const editor = editorElement.getModel()\n // Make sure we halt everything when the editor gets destroyed.\n const edits = await this._formatCodeInTextEditor(editor)\n try {\n const success = applyTextEditsToBuffer(editor.getBuffer(), edits) as boolean\n if (!success) {\n throw new Error(\"No code formatting providers found!\")\n }\n } catch (err) {\n atom.notifications.addError(`Failed to format code: ${err.message}`, {\n detail: err.detail,\n })\n }\n }),\n\n atom.workspace.observeTextEditors((editor) => {\n const editorSubs = new CompositeDisposable(\n // Format on typing in the editor\n editor.getBuffer().onDidStopChanging(async (event) => {\n if (!getFormatOnType()) {\n return\n }\n try {\n await this._formatCodeOnTypeInTextEditor(editor, event)\n } catch (err) {\n getLogger(\"code-format\").warn(\"Failed to format code on type:\", err)\n }\n }),\n // Format on save\n editor.onDidSave(\n debounce(async () => {\n const edits = await this._formatCodeOnSaveInTextEditor(editor)\n const success = applyTextEditsToBuffer(editor.getBuffer(), edits) as boolean\n if (!success) {\n throw new Error(\"No code formatting providers found!\")\n }\n }, SAVE_TIMEOUT)\n )\n )\n // Make sure we halt everything when the editor gets destroyed.\n // We need to capture when editors are about to be destroyed in order to\n // interrupt any pending formatting operations. (Otherwise, we may end up\n // attempting to save a destroyed editor!)\n editor.onDidDestroy(() => editorSubs.dispose())\n })\n )\n\n this._rangeProviders = new ProviderRegistry()\n this._fileProviders = new ProviderRegistry()\n this._onTypeProviders = new ProviderRegistry()\n this._onSaveProviders = new ProviderRegistry()\n }\n\n // Return the text edits used to format code in the editor specified.\n async _formatCodeInTextEditor(\n editor: TextEditor,\n selectionRange: Range = editor.getSelectedBufferRange()\n ): Promise> {\n const buffer = editor.getBuffer()\n const bufferRange = buffer.getRange()\n\n let formatRange: Range\n if (selectionRange.isEmpty()) {\n // If no selection is done, then, the whole file is wanted to be formatted.\n formatRange = bufferRange\n } else {\n const { start: selectionStart, end: selectionEnd } = selectionRange\n // Format selections should start at the beginning of the line,\n // and include the last selected line end.\n // (If the user has already selected complete rows, then depending on how they\n // did it, their caret might be either (1) at the end of their last selected line\n // or (2) at the first column of the line AFTER their selection. In both cases\n // we snap the formatRange to end at the first column of the line after their\n // selection.)\n formatRange = new Range(\n [selectionStart.row, 0],\n selectionEnd.column === 0 ? selectionEnd : [selectionEnd.row + 1, 0]\n )\n }\n\n // range providers\n const rangeProviders = [...this._rangeProviders.getAllProvidersForEditor(editor)]\n const allRangeEdits = await this._reportBusy(\n editor,\n Promise.all(rangeProviders.map((p) => p.formatCode(editor, formatRange)))\n )\n const rangeEdits = allRangeEdits.filter((edits) => edits.length > 0)\n\n // file providers\n const fileProviders = [...this._fileProviders.getAllProvidersForEditor(editor)]\n const allFileEdits = await this._reportBusy(\n editor,\n Promise.all(fileProviders.map((p) => p.formatEntireFile(editor, formatRange)))\n )\n const nonNullFileEdits = allFileEdits.filter((result) => result !== null && result !== undefined) as {\n newCursor?: number\n formatted: string\n }[]\n const contents = editor.getText()\n const editorRange = editor.getBuffer().getRange()\n const fileEdits = nonNullFileEdits.map(({ formatted }) => [\n {\n oldRange: editorRange,\n newText: formatted,\n oldText: contents,\n } as TextEdit,\n ])\n\n // merge edits\n // When formatting the entire file, prefer file-based providers.\n const preferFileEdits = formatRange.isEqual(bufferRange)\n const edits = preferFileEdits ? fileEdits.concat(rangeEdits) : rangeEdits.concat(fileEdits)\n return edits.flat() // TODO or [0]?\n }\n\n async _formatCodeOnTypeInTextEditor(\n editor: TextEditor,\n { changes }: BufferStoppedChangingEvent\n ): Promise> {\n // Don't try to format changes with multiple cursors.\n if (changes.length !== 1) {\n return []\n }\n // if no provider return immediately\n const providers = [...this._onTypeProviders.getAllProvidersForEditor(editor)]\n if (providers.length === 0) {\n return []\n }\n const event = changes[0]\n // This also ensures the non-emptiness of event.newText for below.\n if (!shouldFormatOnType(event)) {\n return []\n }\n // In the case of bracket-matching, we use the last character because that's\n // the character that will usually cause a reformat (i.e. `}` instead of `{`).\n const character = event.newText[event.newText.length - 1]\n\n const contents = editor.getText()\n const cursorPosition = editor.getCursorBufferPosition().copy()\n\n // The bracket-matching package basically overwrites\n //\n // editor.insertText('{');\n //\n // with\n //\n // editor.insertText('{}');\n // cursor.moveLeft();\n //\n // We want to wait until the cursor has actually moved before we issue a\n // format request, so that we format at the right position (and potentially\n // also let any other event handlers have their go).\n const allEdits = await Promise.all(\n providers.map((p) => p.formatAtPosition(editor, editor.getCursorBufferPosition(), character))\n )\n const firstNonEmptyIndex = allEdits.findIndex((edits) => edits.length > 0)\n if (firstNonEmptyIndex === -1) {\n return []\n } else {\n const edits = allEdits[firstNonEmptyIndex]\n const provider = providers[firstNonEmptyIndex]\n _checkContentsAreSame(contents, editor.getText())\n // Note that this modification is not in a transaction, so it applies as a\n // separate editing event than the character typing. This means that you\n // can undo just the formatting by attempting to undo once, and then undo\n // your actual code by undoing again.\n if (!applyTextEditsToBuffer(editor.getBuffer(), edits)) {\n throw new Error(\"Could not apply edits to text buffer.\")\n }\n\n if (provider.keepCursorPosition) {\n editor.setCursorBufferPosition(cursorPosition)\n }\n return edits\n }\n }\n\n async _formatCodeOnSaveInTextEditor(editor: TextEditor): Promise {\n const saveProviders = [...this._onSaveProviders.getAllProvidersForEditor(editor)]\n if (saveProviders.length > 0) {\n const allEdits = await this._reportBusy(\n editor,\n Promise.all(saveProviders.map((p) => p.formatOnSave(editor))),\n false\n )\n const edits = allEdits.filter((edits) => edits.length > 0)\n return edits.flat()\n } else if (getFormatOnSave(editor)) {\n return this._formatCodeInTextEditor(editor, editor.getBuffer().getRange())\n }\n return []\n }\n\n _reportBusy(editor: TextEditor, promise: Promise, revealTooltip: boolean = true): Promise {\n const busySignalService = this._busySignalService\n if (busySignalService !== undefined) {\n const path = editor.getPath()\n const displayPath = path !== undefined ? nuclideUri.basename(path) : \"\"\n return busySignalService.reportBusyWhile(`Formatting code in ${displayPath}`, () => promise, { revealTooltip })\n }\n return promise\n }\n\n addRangeProvider(provider: RangeCodeFormatProvider): Disposable {\n return this._rangeProviders.addProvider(provider)\n }\n\n addFileProvider(provider: FileCodeFormatProvider): Disposable {\n return this._fileProviders.addProvider(provider)\n }\n\n addOnTypeProvider(provider: OnTypeCodeFormatProvider): Disposable {\n return this._onTypeProviders.addProvider(provider)\n }\n\n addOnSaveProvider(provider: OnSaveCodeFormatProvider): Disposable {\n return this._onSaveProviders.addProvider(provider)\n }\n\n consumeBusySignal(busySignalService: BusySignalService): Disposable {\n this._busySignalService = busySignalService\n return new Disposable(() => {\n this._busySignalService = undefined\n })\n }\n\n dispose() {\n this._subscriptions.dispose()\n }\n}\n\nfunction shouldFormatOnType(event: TextChange): boolean {\n // There's not a direct way to figure out what caused this edit event. There\n // are three cases that we want to pay attention to:\n //\n // 1) The user typed a character.\n // 2) The user typed a character, and bracket-matching kicked in, causing\n // there to be two characters typed.\n // 3) The user pasted a string.\n //\n // We only want to trigger autoformatting in the first two cases. However,\n // we can only look at what new string was inserted, and not what actually\n // caused the event, so we just use some heuristics to determine which of\n // these the event probably was depending on what was typed. This means, for\n // example, we may issue spurious format requests when the user pastes a\n // single character, but this is acceptable.\n if (event.oldText !== \"\") {\n // We either just deleted something or replaced a selection. For the time\n // being, we're not going to issue a reformat in that case.\n return false\n } else if (event.newText === \"\") {\n // Not sure what happened here; why did we get an event in this case? Bail\n // for safety.\n return false\n } else if (event.newText.length > 1 && !isBracketPair(event.newText)) {\n return false\n }\n return true\n}\n\n/**\n * We can't tell the difference between a paste and the bracket-matcher package inserting an extra bracket, so we just\n * assume that any pair of brackets that bracket-matcher recognizes was a pair matched by the package.\n */\nfunction isBracketPair(typedText: string): boolean {\n if (atom.packages.getActivePackage(\"bracket-matcher\") === undefined) {\n return false\n }\n const validBracketPairs = atom.config.get(\"bracket-matcher.autocompleteCharacters\") as Array\n return validBracketPairs.includes(typedText)\n}\n\n// Checks whether contents are same in the buffer post-format, throwing if\n// anything has changed.\nfunction _checkContentsAreSame(before: string, after: string): void {\n if (before !== after) {\n throw new Error(\"The file contents were changed before formatting was complete.\")\n }\n}\n","import type { TextEditor } from \"atom\"\n\nexport function getFormatOnSave(editor: TextEditor): boolean {\n return atom.config.get(\"atom-ide-code-format.formatOnSave\", {\n scope: editor.getRootScopeDescriptor(),\n }) as boolean\n}\n\nexport function getFormatOnType(): boolean {\n return atom.config.get(\"atom-ide-code-format.formatOnType\") as boolean\n}\n","/** A faster vresion of lodash.debounce */\n/* eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any */\nexport function debounce void>(func: T, wait: number): T {\n let timeoutId: NodeJS.Timeout | undefined\n // @ts-ignore\n return (...args: Parameters) => {\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId)\n }\n timeoutId = setTimeout(() => {\n func(...args)\n }, wait)\n }\n}\n","import type { Disposable } from \"atom\"\nimport type { BusySignalService } from \"atom-ide-base\"\nimport type {\n RangeCodeFormatProvider,\n FileCodeFormatProvider,\n OnTypeCodeFormatProvider,\n OnSaveCodeFormatProvider,\n} from \"./types\"\n\nimport CodeFormatManager from \"./CodeFormatManager\"\n\nexport { default as config } from \"./config.json\"\n\nlet codeFormatManager: CodeFormatManager\n\nexport function activate() {\n codeFormatManager = new CodeFormatManager()\n}\n\nexport function consumeRangeProvider(provider: RangeCodeFormatProvider): Disposable {\n return codeFormatManager.addRangeProvider(provider)\n}\n\nexport function consumeFileProvider(provider: FileCodeFormatProvider): Disposable {\n return codeFormatManager.addFileProvider(provider)\n}\n\nexport function consumeOnTypeProvider(provider: OnTypeCodeFormatProvider): Disposable {\n return codeFormatManager.addOnTypeProvider(provider)\n}\n\nexport function consumeOnSaveProvider(provider: OnSaveCodeFormatProvider): Disposable {\n return codeFormatManager.addOnSaveProvider(provider)\n}\n\nexport function consumeBusySignal(busySignalService: BusySignalService): Disposable {\n return codeFormatManager.consumeBusySignal(busySignalService)\n}\n\nexport function deactivate() {\n codeFormatManager.dispose()\n}\n\n// TODO remove\nexport { consumeLegacyProvider } from \"./legacy-provider\"\n","// TODO Remove\n\nimport type { Disposable } from \"atom\"\nimport { consumeRangeProvider, consumeFileProvider, consumeOnSaveProvider, consumeOnTypeProvider } from \"./main\"\nimport type { CodeFormatProvider } from \"./types\"\n\nexport function consumeLegacyProvider(provider: CodeFormatProvider): Disposable {\n // Legacy providers used `selector` / `inclusionPriority`.\n // @ts-ignore legacy API compatability.\n provider.grammarScopes =\n provider.grammarScopes ||\n // @ts-ignore\n (provider.selector != null ? provider.selector.split(\", \") : null)\n provider.priority =\n provider.priority != null\n ? provider.priority\n : // @ts-ignore\n provider.inclusionPriority != null\n ? // @ts-ignore\n provider.inclusionPriority\n : 0\n if (\"formatCode\" in provider) {\n return consumeRangeProvider(provider)\n } else if (\"formatEntireFile\" in provider) {\n return consumeFileProvider(provider)\n } else if (\"formatAtPosition\" in provider) {\n return consumeOnTypeProvider(provider)\n } else if (\"formatOnSave\" in provider) {\n return consumeOnSaveProvider(provider)\n }\n throw new Error(\"Invalid code format provider\")\n}\n"],"names":["ProviderRegistry_2","constructor","this","providers","addProvider","provider","index","findIndex","p","priority","push","splice","atom_1","removeProvider","indexOf","getProviderForEditor","editor","grammar","getGrammar","scopeName","findProvider","getAllProvidersForEditor","findAllProviders","grammarScopes","UniversalDisposable","teardowns","disposed","Set","length","add","Error","i","assertTeardown","addUntilDestroyed","destructible","destroyDisposable","onDidDestroy","dispose","remove","teardown","delete","forEach","unsubscribe","destroy","clear","TypeError","emitter","eventName","callback","addListener","removeListener","fn","Observable","create","observer","next","bind","path","atom","workspace","getTextEditors","getPath","buffer","getBuffer","getViewOfEditor","getScrollTop","position","scrollTop","setCursorBufferPosition","autoscroll","setScrollTop","defer","cursor","getCursors","merge","of","getBufferPosition","onDidChangePosition","map","event","newBufferPosition","take","textEditor","readOnlyExceptions","getElement","setAttribute","removeAttribute","enforcedSoftWrap","setSoftWrapped","onDidChangeSoftWrapped","softWrapped","process","nextTick","isDestroyed","item","TextEditor","textEditorElement","bufferLineNumber","getModel","pixelPositionForBufferPosition","top","getLineHeightInPixels","clientHeight","Math","max","focus","views","getView","async","file","options","center","moveCursor","activatePane","activateItem","line","column","pending","currentEditor","getActiveTextEditor","paneContainer","paneContainerForItem","activate","goToLocationInEditor","open","initialLine","initialColumn","searchAllPanes","tmp","captureStackTrace","error","scrollToBufferPosition","goToLocationSubject","Subject","changes","paths","Array","from","keys","checkpoints","Promise","all","createCheckpoint","allOkay","reduce","successSoFar","edits","get","applyTextEdits","checkPoint","revertToCheckpoint","applySortedTextEditsToBuffer","sortEdits","sortedEdits","oldRange","end","isGreaterThan","start","editsOverlap","warn","isEqual","getRange","oldText","getText","setTextViaDiff","newText","checkpoint","applyToBuffer","groupChangesSinceCheckpoint","edit","row","lineLength","lineLengthForRow","getTextInRange","setTextInRange","sort","e1","i1","e2","i2","compare","v","undefined","require","exports","_encode","ch","charCodeAt","toString","toUpperCase","encodeURIComponent2","str","encodeURIComponent","replace","encodeNoop","Object","defineProperty","value","isWindows","URI","_scheme","_empty","_authority","_path","_query","_fragment","_formatted","_fsPath","isUri","thing","authority","fragment","query","scheme","prototype","enumerable","configurable","_driveLetterPath","test","toLowerCase","substr","with","change","ret","_validate","parse","data","_parseComponents","decodeURIComponent","_slash","idx","substring","match","_regexp","exec","components","_schemePattern","_singleSlashStart","_doubleSlashStart","skipEncoding","_asFormatted","uri","encoder","parts","m","_upperCaseDrive","lastIdx","join","toJSON","res","fsPath","external","$mid","revive","result","default","platform","navigator","userAgent","factory","module","xs","s","op","String","CONTROL","BAREWORD","TOKEN","pow","random","env","opts","mapped","chunker","RegExp","filter","Boolean","commented","j","charAt","comment","slice","SQ","DQ","DS","BS","escape","quote","esc","out","isGlob","len","c","parseEnvVar","pattern","varend","varname","getVar","prev","arg","concat","_","pre","key","r","JSON","stringify","acc","split","x","name","message","stack","input_","reference_","useShortVariant","useNumbersOnly","input","reference","Date","getTime","delta","formats","shortFormats","longFormatsNumbers","longFormats","limit","relativeFormat","remainder","round","haystack","char","count","code","args","a","b","maxLength","suffix","separator","level","repeat","noun","needle","ranges","matchIndex","prevRange","markdown","HOUR","DAY","WEEK","YEAR","MONTH","Number","MAX_VALUE","KNOWN_ARCHIVE_EXTENSIONS","URI_PREFIX_REGEX","isRemote","startsWith","isAtomUri","createRemoteUri","hostname","remotePath","hostAndPath","hostSep","_endsWithArchiveSeparator","parseRemoteUri","remoteUri","parsedUri","getHostname","relativePath","joinArray","_testForIllegalUri","uriPathModule","_pathModuleFor","_archiveEncodeArrayInPlace","_archiveDecode","apply","normalize","_archiveEncode","basename","ext","dirname","extname","_getWindowsPathFromWindowsFileUri","prefix","pathModule","win32","_isWindowsPath","contains","parent","child","endsWithSeparator","_isArchiveSeparator","sep","hostFormatters","hostnameToDisplayHostname","current","formatter","nuclideUriToDisplayHostname","ensureTrailingSeparator","endsWith","isAbsolute","isRoot","posix","array","_matchTrailingArchive","other","some","extStart","IMAGE_EXTENSIONS","stripExtension","isLocal","isInArchive","ancestorOutsideArchive","validate","mustBeRemote","getHostnameOpt","archiveJoin","relative","remote","uriEncode","otherEncode","looksLikeImageUri","has","normalizeDir","getParent","uriToNuclideUri","windowsPathFromUri","lspUri","LspUri","nuclideUriToUri","collapse","fp","nuclideUriToDisplayString","registerHostnameFormatter","trimTrailingSeparator","stripped","endsWithEdenDir","isHomeRelative","resolve","expandHomeDir","HOME","UserProfile","os","homePath","splitPathList","delimiter","joinPathList","every","ensureLocalPrefix","localPrefix","parsePath","parsed","root","dir","base","reverse","pathSeparatorFor","hasKnownArchiveExtension","ARCHIVE_SEPARATOR","NUCLIDE_URI_TYPE_NAME","__TEST__","CodeFormatManager","_subscriptions","CompositeDisposable","commands","currentTarget","_formatCodeInTextEditor","applyTextEditsToBuffer","err","notifications","addError","detail","observeTextEditors","editorSubs","onDidStopChanging","config","_formatCodeOnTypeInTextEditor","getLogger","onDidSave","func","wait","timeoutId","clearTimeout","setTimeout","debounce","_formatCodeOnSaveInTextEditor","_rangeProviders","ProviderRegistry","_fileProviders","_onTypeProviders","_onSaveProviders","selectionRange","getSelectedBufferRange","bufferRange","formatRange","isEmpty","selectionStart","selectionEnd","Range","rangeProviders","rangeEdits","_reportBusy","formatCode","fileProviders","nonNullFileEdits","formatEntireFile","contents","editorRange","fileEdits","formatted","flat","typedText","packages","getActivePackage","includes","isBracketPair","shouldFormatOnType","character","cursorPosition","getCursorBufferPosition","copy","allEdits","formatAtPosition","firstNonEmptyIndex","before","after","_checkContentsAreSame","keepCursorPosition","saveProviders","formatOnSave","scope","getRootScopeDescriptor","getFormatOnSave","promise","revealTooltip","busySignalService","_busySignalService","displayPath","nuclideUri","reportBusyWhile","addRangeProvider","addFileProvider","addOnTypeProvider","addOnSaveProvider","consumeBusySignal","Disposable","codeFormatManager","consumeRangeProvider","consumeFileProvider","consumeOnTypeProvider","consumeOnSaveProvider","selector","inclusionPriority"],"mappings":"4aAAA,kBAGAA,qBAAA,MAGEC,cACEC,KAAKC,UAAY,GAGnBC,YAAYC,GACV,MAAMC,EAAQJ,KAAKC,UAAUI,WAAWC,GAAMH,EAASI,SAAWD,EAAEC,WAMpE,OALe,IAAXH,EACFJ,KAAKC,UAAUO,KAAKL,GAEpBH,KAAKC,UAAUQ,OAAOL,EAAO,EAAGD,GAE3B,IAAIO,cAAW,KACpBV,KAAKW,eAAeR,MAIxBQ,eAAeR,GACb,MAAMC,EAAQJ,KAAKC,UAAUW,QAAQT,IACtB,IAAXC,GACFJ,KAAKC,UAAUQ,OAAOL,EAAO,GAKjCS,qBAAqBC,G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1C0hB,gBAAgB1hB,GACd,OAAOH,KAAKwe,eAAete,YAAYC,GAGzC2hB,kBAAkB3hB,GAChB,OAAOH,KAAKye,iBAAiBve,YAAYC,GAG3C4hB,kBAAkB5hB,GAChB,OAAOH,KAAK0e,iBAAiBxe,YAAYC,GAG3C6hB,kBAAkBT,GAEhB,OADAvhB,KAAKwhB,mBAAqBD,EACnB,IAAIU,cAAW,KACpBjiB,KAAKwhB,wBAAqBpW,KAI9BjJ,UACEnC,KAAK8c,eAAe3a,iTG1PxB,IAAI+f,YAMYC,GAAqBhiB,GACnC,OAAO+hB,GAAkBN,iBAAiBzhB,YAG5BiiB,GAAoBjiB,GAClC,OAAO+hB,GAAkBL,gBAAgB1hB,YAG3BkiB,GAAsBliB,GACpC,OAAO+hB,GAAkBJ,kBAAkB3hB,YAG7BmiB,GAAsBniB,GACpC,OAAO+hB,GAAkBH,kBAAkB5hB,+BAhB3C+hB,GAAoB,IAAIrF,yDAmBQ0E,GAChC,OAAOW,GAAkBF,kBAAkBT,0EC9BPphB,GAepC,GAZAA,EAASkB,cACPlB,EAASkB,gBAEa,MAArBlB,EAASoiB,SAAmBpiB,EAASoiB,SAASrP,MAAM,MAAQ,MAC/D/S,EAASI,SACc,MAArBJ,EAASI,SACLJ,EAASI,SAEmB,MAA9BJ,EAASqiB,kBAEPriB,EAASqiB,kBACT,EACF,eAAgBriB,EAClB,OAAOgiB,GAAqBhiB,GACvB,GAAI,qBAAsBA,EAC/B,OAAOiiB,GAAoBjiB,GACtB,GAAI,qBAAsBA,EAC/B,OAAOkiB,GAAsBliB,GACxB,GAAI,iBAAkBA,EAC3B,OAAOmiB,GAAsBniB,GAE/B,MAAM,IAAIyB,MAAM,iKDUhBsgB,GAAkB/f"} \ No newline at end of file diff --git a/dist/src/CodeFormatManager.d.ts b/dist/src/CodeFormatManager.d.ts index d7304f2..9f46cbe 100644 --- a/dist/src/CodeFormatManager.d.ts +++ b/dist/src/CodeFormatManager.d.ts @@ -2,7 +2,7 @@ import { Range, CompositeDisposable, TextEditor, Disposable, BufferStoppedChangi import type { TextEdit, BusySignalService } from "atom-ide-base"; import type { FileCodeFormatProvider, OnSaveCodeFormatProvider, OnTypeCodeFormatProvider, RangeCodeFormatProvider } from "./types"; import { ProviderRegistry } from "atom-ide-base/commons-atom/ProviderRegistry"; -export declare const SAVE_TIMEOUT = 2500; +export declare const SAVE_TIMEOUT = 500; export default class CodeFormatManager { _subscriptions: CompositeDisposable; _rangeProviders: ProviderRegistry; @@ -11,8 +11,8 @@ export default class CodeFormatManager { _onSaveProviders: ProviderRegistry; _busySignalService: BusySignalService | undefined; constructor(); - _formatCodeInTextEditor(editor: TextEditor, range?: Range): Promise>; - _formatCodeOnTypeInTextEditor(editor: TextEditor, aggregatedEvent: BufferStoppedChangingEvent): Promise>; + _formatCodeInTextEditor(editor: TextEditor, selectionRange?: Range): Promise>; + _formatCodeOnTypeInTextEditor(editor: TextEditor, { changes }: BufferStoppedChangingEvent): Promise>; _formatCodeOnSaveInTextEditor(editor: TextEditor): Promise; _reportBusy(editor: TextEditor, promise: Promise, revealTooltip?: boolean): Promise; addRangeProvider(provider: RangeCodeFormatProvider): Disposable; diff --git a/dist/src/utils.d.ts b/dist/src/utils.d.ts new file mode 100644 index 0000000..0abf4c3 --- /dev/null +++ b/dist/src/utils.d.ts @@ -0,0 +1,2 @@ +/** A faster vresion of lodash.debounce */ +export declare function debounce void>(func: T, wait: number): T; diff --git a/dist/tsconfig.tsbuildinfo b/dist/tsconfig.tsbuildinfo index 59c0cc3..03c92e0 100644 --- a/dist/tsconfig.tsbuildinfo +++ b/dist/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/tslib/tslib.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostic_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/ts3.6/base.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/base.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/atom/src/atom-environment.d.ts","../node_modules/@types/atom/src/text-editor-element.d.ts","../node_modules/@types/atom/dependencies/event-kit/index.d.ts","../node_modules/@types/atom/dependencies/first-mate/src/grammar.d.ts","../node_modules/@types/atom/dependencies/first-mate/src/first-mate.d.ts","../node_modules/@types/atom/dependencies/first-mate/index.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/src/file.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/src/directory.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/src/main.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/index.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/display-marker.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/display-marker-layer.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/helpers.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/marker.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/marker-layer.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/point.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/range.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/text-buffer.d.ts","../node_modules/@types/atom/dependencies/text-buffer/index.d.ts","../node_modules/@types/atom/src/buffered-node-process.d.ts","../node_modules/@types/atom/src/buffered-process.d.ts","../node_modules/@types/atom/src/clipboard.d.ts","../node_modules/@types/atom/src/color.d.ts","../node_modules/@types/atom/src/command-registry.d.ts","../node_modules/@types/atom/src/config.d.ts","../node_modules/@types/atom/src/config-schema.d.ts","../node_modules/@types/atom/src/context-menu-manager.d.ts","../node_modules/@types/atom/src/cursor.d.ts","../node_modules/@types/atom/src/decoration.d.ts","../node_modules/@types/atom/src/deserializer-manager.d.ts","../node_modules/@types/atom/src/dock.d.ts","../node_modules/@types/atom/src/get-window-load-settings.d.ts","../node_modules/@types/atom/src/git-repository.d.ts","../node_modules/@types/atom/src/grammar-registry.d.ts","../node_modules/@types/atom/src/gutter.d.ts","../node_modules/@types/atom/src/history-manager.d.ts","../node_modules/@types/atom/src/keymap-extensions.d.ts","../node_modules/@types/atom/src/layer-decoration.d.ts","../node_modules/@types/atom/src/menu-manager.d.ts","../node_modules/@types/atom/src/notification.d.ts","../node_modules/@types/atom/src/notification-manager.d.ts","../node_modules/@types/atom/src/other-types.d.ts","../node_modules/@types/atom/src/package.d.ts","../node_modules/@types/atom/src/package-manager.d.ts","../node_modules/@types/atom/src/pane.d.ts","../node_modules/@types/atom/src/panel.d.ts","../node_modules/@types/atom/src/path-watcher.d.ts","../node_modules/@types/atom/src/project.d.ts","../node_modules/@types/atom/src/scope-descriptor.d.ts","../node_modules/@types/atom/src/selection.d.ts","../node_modules/@types/atom/src/style-manager.d.ts","../node_modules/@types/atom/src/task.d.ts","../node_modules/@types/atom/src/text-editor.d.ts","../node_modules/@types/atom/src/text-editor-component.d.ts","../node_modules/@types/atom/src/text-editor-registry.d.ts","../node_modules/@types/atom/src/theme-manager.d.ts","../node_modules/@types/atom/src/tooltip.d.ts","../node_modules/@types/atom/src/tooltip-manager.d.ts","../node_modules/@types/atom/src/view-registry.d.ts","../node_modules/@types/atom/src/workspace.d.ts","../node_modules/@types/atom/src/workspace-center.d.ts","../node_modules/@types/atom/index.d.ts","../node_modules/atom-ide-base/types-packages/uri.d.ts","../node_modules/atom-ide-base/types-packages/busy-signal.d.ts","../node_modules/atom-ide-base/types-packages/call-hierarchy.d.ts","../node_modules/@types/atom/linter/config.d.ts","../node_modules/@types/atom/linter/index.d.ts","../node_modules/atom-ide-base/types-packages/code-actions.d.ts","../node_modules/atom-ide-base/types-packages/code-highlight.d.ts","../node_modules/atom-ide-base/types-packages/datatip.d.ts","../node_modules/atom-ide-base/types-packages/definitions.d.ts","../node_modules/atom-ide-base/types-packages/find-references.d.ts","../node_modules/atom-ide-base/types-packages/hyperclick.d.ts","../node_modules/atom-ide-base/types-packages/outline.d.ts","../node_modules/atom-ide-base/types-packages/sig-help.d.ts","../node_modules/@types/trusted-types/lib/index.d.ts","../node_modules/@types/trusted-types/index.d.ts","../node_modules/@types/dompurify/index.d.ts","../node_modules/atom-ide-base/types-packages/markdown-service.d.ts","../node_modules/atom-ide-base/types-packages/text-edit.d.ts","../node_modules/atom-ide-base/types-packages/code-format.d.ts","../node_modules/atom-ide-base/types-packages/refactor.d.ts","../node_modules/atom-ide-base/types-packages/console.d.ts","../node_modules/atom-ide-base/types-packages/main.d.ts","../src/types.ts","../src/config.ts","../node_modules/log4js/types/log4js.d.ts","../node_modules/atom-ide-base/commons-atom/ProviderRegistry.d.ts","../src/CodeFormatManager.ts","../src/config.json","../src/main.ts","../src/legacy-provider.ts","../spec/utils.ts","../spec/CodeFormatManager-spec.ts","../node_modules/@types/jasmine/index.d.ts","../node_modules/atom-jasmine3-test-runner/types/index.d.ts","../spec/runner.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/unist/index.d.ts","../node_modules/@types/mdast/index.d.ts","../node_modules/@types/parse-json/index.d.ts","../node_modules/@types/prop-types/index.d.ts","../node_modules/@types/react/global.d.ts","../node_modules/csstype/index.d.ts","../node_modules/@types/scheduler/tracing.d.ts","../node_modules/@types/react/index.d.ts","../node_modules/@types/react-dom/index.d.ts","../node_modules/@types/resolve/index.d.ts","../node_modules/@types/scheduler/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"4576b4e61049f5ffd7c9e935cf88832e089265bdb15ffc35077310042cbbbeea","f5a6d1a8e21751af6fd0a8422d72ba825c15bce9a1af9d02fc0d992406f18f5f",{"version":"bf629ebbac2c65601bcb5c032644023a2b4b3b1151c0d1bf60ced7c35cc81b5d","affectsGlobalScope":true},"9d07804fffa0680a15b100ea9312078ffd9779429719240d3576bb592511bf31",{"version":"c9ed7a82b6c15c29dd1f0350d5c8bd5b9b30fb07a8572c9e6addebf05944e160","affectsGlobalScope":true},"e5cca775079552250e94c7dbbe3ac1a4fa91caae98fd83fb488440d478a5537c","8528e5fe802d788d89df3169c7a7cde25943d1cee6748a26d4210cf37d79baba",{"version":"a4565a5ce32bca81a0bf56c71168e0ca1e0941ccc15f896f808ccc7a71ba6fa8","affectsGlobalScope":true},"3111079f3cb5f2b9c812ca3f46161562bce5bfb355e915f46ed46c41714dc1c3","087a6c005a7aa76ca849cdc25a00de881291278f84361decb42701b8aff52f49","4481cd6e85120ea80d71866890faa032687d29ad820640a2b8547f04b80ed3ba","b6c2782fb0c0f113cc1c38745c57ab499dd4f459d4f76a2c083c9f6609919df0","6ac7d92ba8f420f89f63ad99af8b146a5bbfe6522be2cd7a179cb5e066975825","3996fc0e7ecec3111a208c9f3389f15381907ccfc0804f89839ec3bfdf630576","cea1624c6870349293bb4d5a4fe7b1e963392b50d34fa916a830dac5cd186ab0",{"version":"6189edcaa78cba8c1dfd1d12a8928fe0603e646009ffb9ddfa92eff0d824ce2c","affectsGlobalScope":true},"8123b4a3b707b071088f581a21f01738c7d390a28d5d712ec396d3f411e23037","4ef819c9ddb82d8e8c841c7ba9db2729915a97a0addfcda6a6a9f852b4a2a128","eb83d39b9e8404d7c73adf30bc666894028d9e567384fbf42cbae805058e24aa","99827736d6a22022a5a4c9ad847900667704560e8b10964bdd36d4412c1eb587","ec7606080747d7e424af23f9b69b02cc47855f045edafbdb2552ccdff9556b4f","ef70156b46b854df342204565597787b04ea8067c1bfd673279fc859bcae42b7",{"version":"6583daa9760bda81669417e393cf1fb9208422fdbcb4991569e59347e93f3e34","affectsGlobalScope":true},"ab108213eabd2bb2ea48db3f43ed77ca2965b22b22ad5a3d0c3b13576c60902e","e1aea0bae8186fee1b966d4e4e2a167ed0edd86668c609b1440ed0e81247462d","d15d11ea31228ad0c57cda43b406f7bb1712c6c8fe6dd9c27a90dbfc7a8d6117","ddbc96f468abfe7c1965eb69f75d267b4493a27a8eaa76ea25f8d8ef87fec846",{"version":"6fe3ec84b325c68a572b7febee0446ddccafa67a5c0701857f26acc4fec0801e","affectsGlobalScope":true},"b89ea948a92ce598bac83e0fd39ab4dd1f938b337287abe33d756950bfe31bd7","e09cc4f66a6cf31c2224129e990b91ca00b25b0826989264fbc4aaa7bf9f6460","85df3d396d50cf6706e8a7fdc94402adbfe636ff758ced46cdd8de906957ca1d","e72c97f28066c9d46cb3fe23f2978ef3a4cedee77ff1fd70634654d7df13bc25","7b9958476fc2d098848bad9eb338d0471dc90799235b3c81286da7ed904bcdcd","328b0780f9ea2c65b5811fb3de14122c00b0a6ebe5b9581e8892decd83b1f8a8","c55b1e6bee98c27c3ff8477a47ef182841cbf7883c0e8b47c76506532366c34c",{"version":"34085490aa2954356441cf6e769f2fab1ba11800264cbdcfd9ee10d70fe1ea47","affectsGlobalScope":true},"a7d28061d1dd9315187b6be305be679c0600a335f4921ce66af79b35104e0bbe","1a3649e06d4244990d2c19e0b3a13330b30747818604cdc0ef19318df80a2b3f","5367052357620c6e14cf2a53f7ede9f8d85f4a9dab6facc3da6ae445541b7372","bb0ef00324f06a878b5c102a6b9670d3562126c7a7a09b5318d5c2113974ce1c","1bc668fc53967b5d4071a9094110b20445a5992f9a226874b2c9ac4e904ad033","5c067020e59677ac77cad8b01bdd01361f5315f289bcc50331e5750b4f29f5b7","45e9d7a11405d31fbb49e5d4fbad5c2d7dc9780f64338af388ba7ea9280b468f","6e25f951f1c64dc1fdda83ad3183b4af572b95218e736bf454185ac0c8abdf41","485a02812f947eb6011e70c44b3e815566b354efc90d4c2c5ac9d7bb3b948a42","b5cc8a2bdfe0163d116852650429c0a49ea75211dfaf66b7b0349fee7b3e8d83",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"f87509fed855ba8d77bcc1bbdd1acb8380a8092373c2caf3f04e5a8f8f3c5e5b","7e28b18588869fdeb3ff70581047ea017bae32c0baf1464b5b501c1ae00a96e0","c279f541b15691f99c82e130c9897740adf4584442b3610c5634f5684c1f5b60","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","06b4e032b397f9bad48024b5f942595d2b8c398ab462fd0ba961c5203efb8a55","2b898bb5b99899af6de62cd5b3cf5be9ed2668eb94974dbdb402458e80c27edd","d2104c54b34158356c4c17dd37c7dd29e1c7dc4c77d9077e921f37d0b0f5cb87","8989b83d1d34dc4ef1100cbcc0f983f69d63118aeca3de5947e1c431ccd21ccc","35c935b77ca1da8fbf901931e0d8f25bff1cdedc9cbc01d98180cb496c445c21","3d1ffbc8fc8790ce6eef1e4ce1e79bfd5e9d0bc7d4f7cac0e95c54a7e1141875","128307a9785a229de861f811864e872ccc7b98da7953f6a67168addf64164fae","79d8197c490b07c732957dfc053b0a1bceaeba6cca9d3de6ce784d6b949fca4b","a49b47dfb004f10f3b23bb790de0c74667dfd053f7eda02ac831c351c7875498","5af3737dddb6e952a498672892404be1105ec2751b09467fbb5fd4b95efbd99b","9a1aef5196a946220a7ef874a7bc7424efef78d23ba8ff20df281b36ef62837a","29dd86bbc67e36427086391040eac56c43aff45b34687f4d4e39a9d3e9f2d87b","00b7ef8d8dae6570963d4f3e3027a27bda0d61285ced3ab3c81136c8899b6224","05d99f695e6424963c16f8a990e2fd0b703a8079baa1445ef2915fe525efc85b","ab77be6fc48fb908db04f842e47d944176ac3cc76020c15f382738bd437eed90","575c279d939c1c61b48798fbd747c80871dc3d4c18fcfcdb9924a950ff67cb88","88d9da0dab92c994d171a7999ca48974be8f99c041622a78d0b1f3ff27588fc1","dc172eb5106eefa395d091bdb0d8b1963a86aae82a6a7192c1910e7f11083ccd","79e09e77f7f0e0283ca443ba0eb14243a8a654cb25db6c5250caf4d840cca6ad","2cb11a971470a03e828df7520b3153e514bfc5065597d0690a0439f7a5e4284a","839f9c729f3bfd673257683bb86879ba1c3f8b41f01c2a6a33295ebf14927ab5","ef9084c118d3a104aebed6b88b07149fa5a491652a9ff90d52140cda9f7b317e","4d74b98b593856085848bde7d83f400ad2fe5a2c36ac9dfe863f96ac206ae55d","27656836bf9547d24ed317c044fe1a3feeb58aff8433ba7813d50e8f69088034","e43548a7d9030b2986c73fca5260a49e9246663148eec940c6440772c80da7ba","cdd0d39a4cb0a5adb8e38f542603e3db4bd0ccfde5c69996dd50c9b9a94cd453","a204b31c3672914ff68bb20bfdaae933bf7f8f943687c371b0fd32a3482fc5d4","f152d699e59e304c05779b97a5f518ba9abb8bd24c0b424802bf02b62c919b0f","269c4bd8cb3780736254bb151db215ef3a65af93a900ca3af00cb9b1d8c346b9","be2d0f15d3277a1dd83829a07610da07d4ba584ece64b7292b27f90ab704a7c8","ef048a1d0f1a5f33453b2481987a0f5011e158b757fe4f4def16a2a31efd4623","0534a685ecb1022ec62f19fe7252137f652dde0d86404723e021ed714d44c442","86e61b70ff3e5019f9c85b63a56e8160f9fa712e0e7fe7b4cb7c88f0384ab76a","346bbbe2467175e499c5b1aaa5f665092612ce4a49c2bdc74495e912edc15bbe","429c0ccb47f85fab9f0096859a31f2bc20e2b8a814022cd71f6e5cc88ee550f1","c55319dbab484742322d62bfabe07964e7ea8ae0aafab4476a5467888ed64e7d","6c83ec67f9e4afb6ca82b7be9548cc004e8d9ef6ac6aa29b2a6846cb9e5adb5d","1c8b2d3ff03331ade04d4ec13f9359308bbf481464938107ca40095b8246a229","f50fa063598d47694feba8f4d91f9fcac813b2c6fdaa5981c6ff466952faaf48","1be418e203655427389cd8500372de61fd17cc8a43e1692f2d49df842656b9fd","0a6ec175b75a23cdc119a124d6d16f66338767544afc31ecf35a8ed09d75c98c","b193ed7441b78595000bcd07c92bfa1b36493910579f1c33daafe42a90600537","5ee59e94ca202bace5b0525861270943a8e087f73cd32d75ccf11f9660f8f9cb","e3d78def8d4e6bb8397b25068fdae6eac9d181a75c78dcf20227a251ee00bce3","0d70c986f1a71c38bf3c3c6b54425c4ba624642231ea8471a21adcd69ecbdd4d","f35e1e9878ed539da642f82e325bbfdfd6478a4146e9c6293e6bf9cbf5850c44","3a46c481fc512cce568b39ab364bb02ec588fc276240caf34e015444a5fd26d2","9098640c076d1bdbe6daf7b48d08bb2200ac28cce6db7d08118ae676a99406c9","ff79f90c32d4c308ed74a2a13834785d64d0ad0451aa72c6db55094ca73d43ed","7916e7c886d2088f3a9cad90c7967426d23a92930baf4f9e3b027cb904bc5c09","35cdcc6eb65ef5c7725e1d9744c4bdb59253b283b539df1d3e2727383809bd6c","c6e2264465eb2e8cb2e12b67adc878e3a397efd6328e550b0a1a5bffabcad66d","048f40812b2a786d92fc8db2f174d35fa64581859cef090087a0f392d4010a3d","2fbb3b8172720d956fc349d791f4a89274cdd6f794083bf933fdeed6f8a3863b","2163bfddb0e1569e330731191e593feb3582cd0d27518993b6970aa8d62016ed","d302ecc0b3d2c60e6408fd2469e726967c7114d5f89b97d82f316feb8557c69d","4782235ebc38ab1dada9c9bb80ee43982f076c6d420bb0772c40fe615901889c","74d0e861aeeb84c692dbc8de307d62adcfabf56d916747f09b81b1f9110e8d99","a319dda4a8637ce94901abfb5275e653d0d8c5e6323656218c51257ab6f82456","26062553cec8ef883a3617e98d29b395419287e48f4102105a2ee80c1997bac1","08ef92144166ad7d52329793b355ddd7f437e7c8d1d3743fcbb2d2c68cdb7e7a","f2b32e966e35467d563af676842b4e0718f1cd634f2dfdce3972ae101e5a8564",{"version":"00ef4a4324556eab6e45809e757354899d1ded0f5b2134465ee10e450f9c8d61","affectsGlobalScope":true},"56e9508f9d3e8c96d3a3f1658371293e8bc04f814da40ab3fde1b41edce4c5dd","ccf9692fd3d341b32687f940ad0fe5ce7a66e90b496fe480f666e5a364a4f191","f6da04ced79d25ce77eab9ea71a2983e26dd66314aaa654816567785b7fe2dee","e149341309d7f08a73ade2b661a2f127ba560b7ea1780e85acfe3cdcb3d92be0","4f873a462f3653de5ac9ac1dc5a8e3c124efb25990972db81b8abee3ebae3f0a","24ba650ab9f65272df767eeee4290eade7025e5133f2f0ab68105cf9e334d301","87dd41b85c6a3d3325a8b3ab428c9c1f76bc6d1b651c879fa97d59223451cdcd","eb71b8b3341c222f144cf32f42f9b9148d7b627e5b3c6103a5f3ac56c560a158","ef99471758dc73c45801a60d26307bb516d10f89e5903c91c5eff672e932ccb1","bdb4c178a8f8ff60adafd15d70fdf6b46d3c6f81f6df1e3e7a28591f469a387d","347038ff8218327f04a203e94b4d6aa0880e03c595d8b216f5d937d0cf399fd2","fd0f0447797aed4a9ca12bc550431dc5e3abfd8457ae4aa097d8f33edee28e98","a31b2eb749842299eea366c746b942d1b701d10468e3fea0d5d4ec995d26247b","2fcd2d22b1f30555e785105597cd8f57ed50300e213c4f1bbca6ae149f782c38",{"version":"bb4248c7f953233ac52332088fac897d62b82be07244e551d87c5049600b6cf7","affectsGlobalScope":true},"86fd1a4f883c8f923441b8e6c87a2dca5e9821686034bc16ff2fa47a78d490e6","f6b34ae1d3cb81d3c650290d01bc9c594b8fc04cfbc36d80d53cdf383f2e1233","bfe6237b2761c335b61c7fe90fa3e451e582d5ff1109b9225f1e188dd59efd57","a494399a814393efdcd4066904822d0292e7b999bca3fc91478b0f4bad64967b","74e89ad35934a9146c55e67657e23447a56f06ee0273eb44ddf0d248e9d67fcd","3077b10aeb84262b97adbd643e603ee5db682f2fdb8ea7b61fbc44bf3513462c","06ed91e3b43a8b7a1c2fe5ae698244083a09573c55eb2817b469f92bbd69900e","0a2ab125850824d588017693993458942c0fe8a8fc3b7f1dfea12f4065d44511","cff7b50265c69c4af0eb722967d95c9049dd081682aec6ad3b9207e7301c318b","0f6c3917f03c518a3c0b899c8eae3ecd974fd32f88dcbb09671c206af6d18db4","4f708365069dd7e37e068756288d8c0b6846e58b4c1b17a1260c81f9654a6114","873c5b8322ab22116b2d282c26a6788d980de2a56df2ba672d63376543c92e40",{"version":"185c561927e055b70851b98d2991c117e19a25e803968470d4a4265f52288ee6","affectsGlobalScope":true},"58a16eaa92a162dfc251db07f04b8511e6a07eaf558563634b3c8ecc7d908d5b","128871d766b4ce78cdd5ba772e30b699ff69f5e38954101654f9deb25a6df454","f726c565fa43df3f3d8f44aa920434fa417898d72fda1b51ba98f91e42e039ce","ccf4459c9b3a8443fad5a944b6d7c0867ad95e054967d5859a41178ae6022b56",{"version":"109b47aaf8cff564cce2606003778b2b688d849196656e34e134287b08d45ad8","affectsGlobalScope":true},"3210eb31e629ed09089bdc47a79fe368a7458f7a357fe4ed06089dccadc95446","057a2169f1a05182e4fa5f10b170e4d0c5182ff9dc67e3a428e39fe616cf3c11","89ccbe04e737ce613f5f04990271cfa84901446350b8551b0555ddf19319723b","a185ebc69c9f6798ebd67bfdfd72a37457dc67c23459784783c7128ae9bd5250","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","36b374bda8f87b67816ce80a538b52350b37357b77b6baf9b5b48cfe54ca540d","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380",{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"4ee363f83d7be2202f34fcd84c44da71bf3a9329fee8a05f976f75083a52ea94","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"2f1fdc948954bec1253759db6b57952133e38ebb33c990c8d2c81d8ee0b8eea7","affectsGlobalScope":true},"b4dfafe583b829a382edccbe32303535d0785f0c02ba7f04418e2a81de97af8a","8a19491eba2108d5c333c249699f40aff05ad312c04a17504573b27d91f0aede","74b0245c42990ed8a849df955db3f4362c81b13f799ebc981b7bec2d5b414a57"],"options":{"declaration":true,"downlevelIteration":true,"emitDeclarationOnly":false,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"importHelpers":true,"inlineSourceMap":false,"inlineSources":true,"module":99,"noEmitHelpers":true,"noEmitOnError":false,"noFallthroughCasesInSwitch":true,"noImplicitAny":false,"noImplicitReturns":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"target":5},"fileIdsList":[[69,70],[69,70,90],[69,70,89],[69,70,147],[69,70,94],[69,70,92,147],[50,69,70,93,147],[69,70,92,93],[69,70,103],[69,70,103,147],[50,69,70,96,97,98,99,100,101,102,103,147],[69,70,85,86,87,88,91,95,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146],[69,70,111,147],[69,70,147,151],[39,69,70,147],[69,70,162],[69,70,185],[69,70,83],[35,69,70,83],[37,69,70],[69,70,82,83],[38,43,69,70],[39,49,50,57,66,69,70],[39,40,49,57,69,70],[41,69,70,75],[42,43,50,58,69,70],[43,66,69,70,71],[44,46,49,57,69,70],[45,69,70],[46,47,69,70],[48,49,69,70],[49,69,70],[49,50,51,66,69,70,74],[49,50,51,66,69,70],[52,57,66,69,70,74],[49,50,52,53,57,66,69,70,71,74],[52,54,69,70,71,74],[69,70,84],[49,55,69,70],[56,69,70,74],[46,49,57,66,69,70],[58,69,70],[59,69,70],[37,60,69,70],[61,69,70,73,78],[62,69,70],[63,69,70],[49,64,69,70],[64,65,69,70,75,77],[49,66,67,69,70],[66,67,69,70],[68,69,70],[69],[43,57,69,70,71],[69,70,72],[35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],[57,69,70,73],[52,63,69,70,74],[43,69,70,75],[66,69,70,76],[69,70,77],[69,70,81],[38,43,49,51,60,66,69,70,74,77,78],[66,69,70,79],[69,70,192],[69,70,188,189,190,191],[69,70,85],[69,70,161],[69,70,147,169],[69,70,148],[69,70,147,148],[69,70,147,152],[69,70,147,165],[69,70,148,149,150,153,154,155,156,157,158,159,160,164,165,166,167,168],[69,70,163],[69,70,147,148,165],[69,70,147,180],[34,69,70,147,171,174,178],[34,69,70,181],[34,69,70],[34,69,70,147,169,170,171,172,173],[34,69,70,147],[34,69,70,147,170,176],[34,69,70,147,169,170,174,175,177],[34,69,70,147,169]],"referencedMap":[[88,1],[91,2],[90,3],[89,4],[95,5],[93,6],[92,7],[94,8],[104,9],[97,10],[96,10],[98,9],[100,10],[99,10],[101,1],[102,9],[103,11],[147,12],[151,13],[152,14],[86,4],[105,4],[106,15],[107,1],[108,1],[109,4],[111,14],[110,4],[112,4],[113,4],[114,4],[115,4],[116,4],[117,1],[118,4],[119,4],[120,4],[121,4],[122,4],[123,4],[124,4],[126,4],[125,4],[127,4],[129,4],[128,4],[130,4],[131,4],[132,4],[133,4],[134,1],[135,4],[136,4],[137,4],[139,4],[87,4],[140,4],[138,4],[141,4],[143,4],[142,1],[144,4],[146,4],[145,4],[163,16],[183,1],[180,1],[184,1],[186,17],[83,18],[35,19],[37,20],[84,21],[38,22],[39,23],[40,24],[41,25],[42,26],[43,27],[44,28],[45,29],[46,30],[47,30],[48,31],[49,32],[50,33],[51,34],[36,1],[80,1],[52,35],[53,36],[54,37],[85,38],[55,39],[56,40],[57,41],[58,42],[59,43],[60,44],[61,45],[62,46],[63,47],[64,48],[65,49],[66,50],[67,51],[68,52],[69,32],[70,53],[71,54],[72,55],[82,56],[73,57],[74,58],[75,59],[76,60],[77,61],[81,62],[78,63],[79,64],[187,1],[188,1],[193,65],[189,1],[192,66],[194,67],[195,1],[191,1],[162,68],[161,1],[185,1],[173,69],[149,70],[150,71],[153,72],[166,73],[154,4],[168,1],[155,4],[156,71],[157,71],[158,4],[169,74],[164,75],[159,4],[167,76],[160,4],[165,4],[148,1],[181,77],[190,1],[172,1],[34,1],[7,1],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[1,1],[33,1],[179,78],[182,79],[178,80],[174,81],[175,80],[171,82],[177,83],[176,84],[170,85]],"exportedModulesMap":[[88,1],[91,2],[90,3],[89,4],[95,5],[93,6],[92,7],[94,8],[104,9],[97,10],[96,10],[98,9],[100,10],[99,10],[101,1],[102,9],[103,11],[147,12],[151,13],[152,14],[86,4],[105,4],[106,15],[107,1],[108,1],[109,4],[111,14],[110,4],[112,4],[113,4],[114,4],[115,4],[116,4],[117,1],[118,4],[119,4],[120,4],[121,4],[122,4],[123,4],[124,4],[126,4],[125,4],[127,4],[129,4],[128,4],[130,4],[131,4],[132,4],[133,4],[134,1],[135,4],[136,4],[137,4],[139,4],[87,4],[140,4],[138,4],[141,4],[143,4],[142,1],[144,4],[146,4],[145,4],[163,16],[183,1],[180,1],[184,1],[186,17],[83,18],[35,19],[37,20],[84,21],[38,22],[39,23],[40,24],[41,25],[42,26],[43,27],[44,28],[45,29],[46,30],[47,30],[48,31],[49,32],[50,33],[51,34],[36,1],[80,1],[52,35],[53,36],[54,37],[85,38],[55,39],[56,40],[57,41],[58,42],[59,43],[60,44],[61,45],[62,46],[63,47],[64,48],[65,49],[66,50],[67,51],[68,52],[69,32],[70,53],[71,54],[72,55],[82,56],[73,57],[74,58],[75,59],[76,60],[77,61],[81,62],[78,63],[79,64],[187,1],[188,1],[193,65],[189,1],[192,66],[194,67],[195,1],[191,1],[162,68],[161,1],[185,1],[173,69],[149,70],[150,71],[153,72],[166,73],[154,4],[168,1],[155,4],[156,71],[157,71],[158,4],[169,74],[164,75],[159,4],[167,76],[160,4],[165,4],[148,1],[181,77],[190,1],[172,1],[34,1],[7,1],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[1,1],[33,1],[179,78],[182,79],[178,80],[174,81],[175,80],[171,82],[177,83],[176,84],[170,85]],"semanticDiagnosticsPerFile":[88,91,90,89,95,93,92,94,104,97,96,98,100,99,101,102,103,147,151,152,86,105,106,107,108,109,111,110,112,113,114,115,116,117,118,119,120,121,122,123,124,126,125,127,129,128,130,131,132,133,134,135,136,137,139,87,140,138,141,143,142,144,146,145,163,183,180,184,186,83,35,37,84,38,39,40,41,42,43,44,45,46,47,48,49,50,51,36,80,52,53,54,85,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,82,73,74,75,76,77,81,78,79,187,188,193,189,192,194,195,191,162,161,185,173,149,150,153,166,154,168,155,156,157,158,169,164,159,167,160,165,148,181,190,172,34,7,9,8,2,10,11,12,13,14,15,16,17,3,4,21,18,19,20,22,23,24,5,25,26,27,28,6,29,30,31,32,1,33,179,182,178,174,175,171,177,176,170]},"version":"4.3.5"} \ No newline at end of file +{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/tslib/tslib.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostic_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/ts3.6/base.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/base.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/atom/src/atom-environment.d.ts","../node_modules/@types/atom/src/text-editor-element.d.ts","../node_modules/@types/atom/dependencies/event-kit/index.d.ts","../node_modules/@types/atom/dependencies/first-mate/src/grammar.d.ts","../node_modules/@types/atom/dependencies/first-mate/src/first-mate.d.ts","../node_modules/@types/atom/dependencies/first-mate/index.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/src/file.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/src/directory.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/src/main.d.ts","../node_modules/@types/atom/dependencies/pathwatcher/index.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/display-marker.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/display-marker-layer.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/helpers.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/marker.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/marker-layer.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/point.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/range.d.ts","../node_modules/@types/atom/dependencies/text-buffer/src/text-buffer.d.ts","../node_modules/@types/atom/dependencies/text-buffer/index.d.ts","../node_modules/@types/atom/src/buffered-node-process.d.ts","../node_modules/@types/atom/src/buffered-process.d.ts","../node_modules/@types/atom/src/clipboard.d.ts","../node_modules/@types/atom/src/color.d.ts","../node_modules/@types/atom/src/command-registry.d.ts","../node_modules/@types/atom/src/config.d.ts","../node_modules/@types/atom/src/config-schema.d.ts","../node_modules/@types/atom/src/context-menu-manager.d.ts","../node_modules/@types/atom/src/cursor.d.ts","../node_modules/@types/atom/src/decoration.d.ts","../node_modules/@types/atom/src/deserializer-manager.d.ts","../node_modules/@types/atom/src/dock.d.ts","../node_modules/@types/atom/src/get-window-load-settings.d.ts","../node_modules/@types/atom/src/git-repository.d.ts","../node_modules/@types/atom/src/grammar-registry.d.ts","../node_modules/@types/atom/src/gutter.d.ts","../node_modules/@types/atom/src/history-manager.d.ts","../node_modules/@types/atom/src/keymap-extensions.d.ts","../node_modules/@types/atom/src/layer-decoration.d.ts","../node_modules/@types/atom/src/menu-manager.d.ts","../node_modules/@types/atom/src/notification.d.ts","../node_modules/@types/atom/src/notification-manager.d.ts","../node_modules/@types/atom/src/other-types.d.ts","../node_modules/@types/atom/src/package.d.ts","../node_modules/@types/atom/src/package-manager.d.ts","../node_modules/@types/atom/src/pane.d.ts","../node_modules/@types/atom/src/panel.d.ts","../node_modules/@types/atom/src/path-watcher.d.ts","../node_modules/@types/atom/src/project.d.ts","../node_modules/@types/atom/src/scope-descriptor.d.ts","../node_modules/@types/atom/src/selection.d.ts","../node_modules/@types/atom/src/style-manager.d.ts","../node_modules/@types/atom/src/task.d.ts","../node_modules/@types/atom/src/text-editor.d.ts","../node_modules/@types/atom/src/text-editor-component.d.ts","../node_modules/@types/atom/src/text-editor-registry.d.ts","../node_modules/@types/atom/src/theme-manager.d.ts","../node_modules/@types/atom/src/tooltip.d.ts","../node_modules/@types/atom/src/tooltip-manager.d.ts","../node_modules/@types/atom/src/view-registry.d.ts","../node_modules/@types/atom/src/workspace.d.ts","../node_modules/@types/atom/src/workspace-center.d.ts","../node_modules/@types/atom/index.d.ts","../node_modules/atom-ide-base/types-packages/uri.d.ts","../node_modules/atom-ide-base/types-packages/busy-signal.d.ts","../node_modules/atom-ide-base/types-packages/call-hierarchy.d.ts","../node_modules/@types/atom/linter/config.d.ts","../node_modules/@types/atom/linter/index.d.ts","../node_modules/atom-ide-base/types-packages/code-actions.d.ts","../node_modules/atom-ide-base/types-packages/code-highlight.d.ts","../node_modules/atom-ide-base/types-packages/datatip.d.ts","../node_modules/atom-ide-base/types-packages/definitions.d.ts","../node_modules/atom-ide-base/types-packages/find-references.d.ts","../node_modules/atom-ide-base/types-packages/hyperclick.d.ts","../node_modules/atom-ide-base/types-packages/outline.d.ts","../node_modules/atom-ide-base/types-packages/sig-help.d.ts","../node_modules/@types/trusted-types/lib/index.d.ts","../node_modules/@types/trusted-types/index.d.ts","../node_modules/@types/dompurify/index.d.ts","../node_modules/atom-ide-base/types-packages/markdown-service.d.ts","../node_modules/atom-ide-base/types-packages/text-edit.d.ts","../node_modules/atom-ide-base/types-packages/code-format.d.ts","../node_modules/atom-ide-base/types-packages/refactor.d.ts","../node_modules/atom-ide-base/types-packages/console.d.ts","../node_modules/atom-ide-base/types-packages/main.d.ts","../src/types.ts","../src/config.ts","../node_modules/log4js/types/log4js.d.ts","../node_modules/atom-ide-base/commons-atom/ProviderRegistry.d.ts","../src/utils.ts","../src/CodeFormatManager.ts","../src/config.json","../src/main.ts","../src/legacy-provider.ts","../spec/utils.ts","../spec/CodeFormatManager-spec.ts","../node_modules/@types/jasmine/index.d.ts","../node_modules/atom-jasmine3-test-runner/types/index.d.ts","../spec/runner.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/unist/index.d.ts","../node_modules/@types/mdast/index.d.ts","../node_modules/@types/parse-json/index.d.ts","../node_modules/@types/prop-types/index.d.ts","../node_modules/@types/react/global.d.ts","../node_modules/csstype/index.d.ts","../node_modules/@types/scheduler/tracing.d.ts","../node_modules/@types/react/index.d.ts","../node_modules/@types/react-dom/index.d.ts","../node_modules/@types/resolve/index.d.ts","../node_modules/@types/scheduler/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"4576b4e61049f5ffd7c9e935cf88832e089265bdb15ffc35077310042cbbbeea","f5a6d1a8e21751af6fd0a8422d72ba825c15bce9a1af9d02fc0d992406f18f5f",{"version":"bf629ebbac2c65601bcb5c032644023a2b4b3b1151c0d1bf60ced7c35cc81b5d","affectsGlobalScope":true},"9d07804fffa0680a15b100ea9312078ffd9779429719240d3576bb592511bf31",{"version":"c9ed7a82b6c15c29dd1f0350d5c8bd5b9b30fb07a8572c9e6addebf05944e160","affectsGlobalScope":true},"e5cca775079552250e94c7dbbe3ac1a4fa91caae98fd83fb488440d478a5537c","8528e5fe802d788d89df3169c7a7cde25943d1cee6748a26d4210cf37d79baba",{"version":"a4565a5ce32bca81a0bf56c71168e0ca1e0941ccc15f896f808ccc7a71ba6fa8","affectsGlobalScope":true},"3111079f3cb5f2b9c812ca3f46161562bce5bfb355e915f46ed46c41714dc1c3","087a6c005a7aa76ca849cdc25a00de881291278f84361decb42701b8aff52f49","4481cd6e85120ea80d71866890faa032687d29ad820640a2b8547f04b80ed3ba","b6c2782fb0c0f113cc1c38745c57ab499dd4f459d4f76a2c083c9f6609919df0","6ac7d92ba8f420f89f63ad99af8b146a5bbfe6522be2cd7a179cb5e066975825","3996fc0e7ecec3111a208c9f3389f15381907ccfc0804f89839ec3bfdf630576","cea1624c6870349293bb4d5a4fe7b1e963392b50d34fa916a830dac5cd186ab0",{"version":"6189edcaa78cba8c1dfd1d12a8928fe0603e646009ffb9ddfa92eff0d824ce2c","affectsGlobalScope":true},"8123b4a3b707b071088f581a21f01738c7d390a28d5d712ec396d3f411e23037","4ef819c9ddb82d8e8c841c7ba9db2729915a97a0addfcda6a6a9f852b4a2a128","eb83d39b9e8404d7c73adf30bc666894028d9e567384fbf42cbae805058e24aa","99827736d6a22022a5a4c9ad847900667704560e8b10964bdd36d4412c1eb587","ec7606080747d7e424af23f9b69b02cc47855f045edafbdb2552ccdff9556b4f","ef70156b46b854df342204565597787b04ea8067c1bfd673279fc859bcae42b7",{"version":"6583daa9760bda81669417e393cf1fb9208422fdbcb4991569e59347e93f3e34","affectsGlobalScope":true},"ab108213eabd2bb2ea48db3f43ed77ca2965b22b22ad5a3d0c3b13576c60902e","e1aea0bae8186fee1b966d4e4e2a167ed0edd86668c609b1440ed0e81247462d","d15d11ea31228ad0c57cda43b406f7bb1712c6c8fe6dd9c27a90dbfc7a8d6117","ddbc96f468abfe7c1965eb69f75d267b4493a27a8eaa76ea25f8d8ef87fec846",{"version":"6fe3ec84b325c68a572b7febee0446ddccafa67a5c0701857f26acc4fec0801e","affectsGlobalScope":true},"b89ea948a92ce598bac83e0fd39ab4dd1f938b337287abe33d756950bfe31bd7","e09cc4f66a6cf31c2224129e990b91ca00b25b0826989264fbc4aaa7bf9f6460","85df3d396d50cf6706e8a7fdc94402adbfe636ff758ced46cdd8de906957ca1d","e72c97f28066c9d46cb3fe23f2978ef3a4cedee77ff1fd70634654d7df13bc25","7b9958476fc2d098848bad9eb338d0471dc90799235b3c81286da7ed904bcdcd","328b0780f9ea2c65b5811fb3de14122c00b0a6ebe5b9581e8892decd83b1f8a8","c55b1e6bee98c27c3ff8477a47ef182841cbf7883c0e8b47c76506532366c34c",{"version":"34085490aa2954356441cf6e769f2fab1ba11800264cbdcfd9ee10d70fe1ea47","affectsGlobalScope":true},"a7d28061d1dd9315187b6be305be679c0600a335f4921ce66af79b35104e0bbe","1a3649e06d4244990d2c19e0b3a13330b30747818604cdc0ef19318df80a2b3f","5367052357620c6e14cf2a53f7ede9f8d85f4a9dab6facc3da6ae445541b7372","bb0ef00324f06a878b5c102a6b9670d3562126c7a7a09b5318d5c2113974ce1c","1bc668fc53967b5d4071a9094110b20445a5992f9a226874b2c9ac4e904ad033","5c067020e59677ac77cad8b01bdd01361f5315f289bcc50331e5750b4f29f5b7","45e9d7a11405d31fbb49e5d4fbad5c2d7dc9780f64338af388ba7ea9280b468f","6e25f951f1c64dc1fdda83ad3183b4af572b95218e736bf454185ac0c8abdf41","485a02812f947eb6011e70c44b3e815566b354efc90d4c2c5ac9d7bb3b948a42","b5cc8a2bdfe0163d116852650429c0a49ea75211dfaf66b7b0349fee7b3e8d83",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"f87509fed855ba8d77bcc1bbdd1acb8380a8092373c2caf3f04e5a8f8f3c5e5b","7e28b18588869fdeb3ff70581047ea017bae32c0baf1464b5b501c1ae00a96e0","c279f541b15691f99c82e130c9897740adf4584442b3610c5634f5684c1f5b60","e61a21e9418f279bc480394a94d1581b2dee73747adcbdef999b6737e34d721b","06b4e032b397f9bad48024b5f942595d2b8c398ab462fd0ba961c5203efb8a55","2b898bb5b99899af6de62cd5b3cf5be9ed2668eb94974dbdb402458e80c27edd","d2104c54b34158356c4c17dd37c7dd29e1c7dc4c77d9077e921f37d0b0f5cb87","8989b83d1d34dc4ef1100cbcc0f983f69d63118aeca3de5947e1c431ccd21ccc","35c935b77ca1da8fbf901931e0d8f25bff1cdedc9cbc01d98180cb496c445c21","3d1ffbc8fc8790ce6eef1e4ce1e79bfd5e9d0bc7d4f7cac0e95c54a7e1141875","128307a9785a229de861f811864e872ccc7b98da7953f6a67168addf64164fae","79d8197c490b07c732957dfc053b0a1bceaeba6cca9d3de6ce784d6b949fca4b","a49b47dfb004f10f3b23bb790de0c74667dfd053f7eda02ac831c351c7875498","5af3737dddb6e952a498672892404be1105ec2751b09467fbb5fd4b95efbd99b","9a1aef5196a946220a7ef874a7bc7424efef78d23ba8ff20df281b36ef62837a","29dd86bbc67e36427086391040eac56c43aff45b34687f4d4e39a9d3e9f2d87b","00b7ef8d8dae6570963d4f3e3027a27bda0d61285ced3ab3c81136c8899b6224","05d99f695e6424963c16f8a990e2fd0b703a8079baa1445ef2915fe525efc85b","ab77be6fc48fb908db04f842e47d944176ac3cc76020c15f382738bd437eed90","575c279d939c1c61b48798fbd747c80871dc3d4c18fcfcdb9924a950ff67cb88","88d9da0dab92c994d171a7999ca48974be8f99c041622a78d0b1f3ff27588fc1","dc172eb5106eefa395d091bdb0d8b1963a86aae82a6a7192c1910e7f11083ccd","79e09e77f7f0e0283ca443ba0eb14243a8a654cb25db6c5250caf4d840cca6ad","2cb11a971470a03e828df7520b3153e514bfc5065597d0690a0439f7a5e4284a","839f9c729f3bfd673257683bb86879ba1c3f8b41f01c2a6a33295ebf14927ab5","ef9084c118d3a104aebed6b88b07149fa5a491652a9ff90d52140cda9f7b317e","4d74b98b593856085848bde7d83f400ad2fe5a2c36ac9dfe863f96ac206ae55d","27656836bf9547d24ed317c044fe1a3feeb58aff8433ba7813d50e8f69088034","e43548a7d9030b2986c73fca5260a49e9246663148eec940c6440772c80da7ba","cdd0d39a4cb0a5adb8e38f542603e3db4bd0ccfde5c69996dd50c9b9a94cd453","a204b31c3672914ff68bb20bfdaae933bf7f8f943687c371b0fd32a3482fc5d4","f152d699e59e304c05779b97a5f518ba9abb8bd24c0b424802bf02b62c919b0f","269c4bd8cb3780736254bb151db215ef3a65af93a900ca3af00cb9b1d8c346b9","be2d0f15d3277a1dd83829a07610da07d4ba584ece64b7292b27f90ab704a7c8","ef048a1d0f1a5f33453b2481987a0f5011e158b757fe4f4def16a2a31efd4623","0534a685ecb1022ec62f19fe7252137f652dde0d86404723e021ed714d44c442","86e61b70ff3e5019f9c85b63a56e8160f9fa712e0e7fe7b4cb7c88f0384ab76a","346bbbe2467175e499c5b1aaa5f665092612ce4a49c2bdc74495e912edc15bbe","429c0ccb47f85fab9f0096859a31f2bc20e2b8a814022cd71f6e5cc88ee550f1","c55319dbab484742322d62bfabe07964e7ea8ae0aafab4476a5467888ed64e7d","6c83ec67f9e4afb6ca82b7be9548cc004e8d9ef6ac6aa29b2a6846cb9e5adb5d","1c8b2d3ff03331ade04d4ec13f9359308bbf481464938107ca40095b8246a229","f50fa063598d47694feba8f4d91f9fcac813b2c6fdaa5981c6ff466952faaf48","1be418e203655427389cd8500372de61fd17cc8a43e1692f2d49df842656b9fd","0a6ec175b75a23cdc119a124d6d16f66338767544afc31ecf35a8ed09d75c98c","b193ed7441b78595000bcd07c92bfa1b36493910579f1c33daafe42a90600537","5ee59e94ca202bace5b0525861270943a8e087f73cd32d75ccf11f9660f8f9cb","e3d78def8d4e6bb8397b25068fdae6eac9d181a75c78dcf20227a251ee00bce3","0d70c986f1a71c38bf3c3c6b54425c4ba624642231ea8471a21adcd69ecbdd4d","f35e1e9878ed539da642f82e325bbfdfd6478a4146e9c6293e6bf9cbf5850c44","3a46c481fc512cce568b39ab364bb02ec588fc276240caf34e015444a5fd26d2","9098640c076d1bdbe6daf7b48d08bb2200ac28cce6db7d08118ae676a99406c9","ff79f90c32d4c308ed74a2a13834785d64d0ad0451aa72c6db55094ca73d43ed","7916e7c886d2088f3a9cad90c7967426d23a92930baf4f9e3b027cb904bc5c09","35cdcc6eb65ef5c7725e1d9744c4bdb59253b283b539df1d3e2727383809bd6c","c6e2264465eb2e8cb2e12b67adc878e3a397efd6328e550b0a1a5bffabcad66d","048f40812b2a786d92fc8db2f174d35fa64581859cef090087a0f392d4010a3d","2fbb3b8172720d956fc349d791f4a89274cdd6f794083bf933fdeed6f8a3863b","2163bfddb0e1569e330731191e593feb3582cd0d27518993b6970aa8d62016ed","d302ecc0b3d2c60e6408fd2469e726967c7114d5f89b97d82f316feb8557c69d","4782235ebc38ab1dada9c9bb80ee43982f076c6d420bb0772c40fe615901889c","74d0e861aeeb84c692dbc8de307d62adcfabf56d916747f09b81b1f9110e8d99","a319dda4a8637ce94901abfb5275e653d0d8c5e6323656218c51257ab6f82456","26062553cec8ef883a3617e98d29b395419287e48f4102105a2ee80c1997bac1","08ef92144166ad7d52329793b355ddd7f437e7c8d1d3743fcbb2d2c68cdb7e7a","f2b32e966e35467d563af676842b4e0718f1cd634f2dfdce3972ae101e5a8564",{"version":"00ef4a4324556eab6e45809e757354899d1ded0f5b2134465ee10e450f9c8d61","affectsGlobalScope":true},"56e9508f9d3e8c96d3a3f1658371293e8bc04f814da40ab3fde1b41edce4c5dd","ccf9692fd3d341b32687f940ad0fe5ce7a66e90b496fe480f666e5a364a4f191","f6da04ced79d25ce77eab9ea71a2983e26dd66314aaa654816567785b7fe2dee","e149341309d7f08a73ade2b661a2f127ba560b7ea1780e85acfe3cdcb3d92be0","4f873a462f3653de5ac9ac1dc5a8e3c124efb25990972db81b8abee3ebae3f0a","24ba650ab9f65272df767eeee4290eade7025e5133f2f0ab68105cf9e334d301","87dd41b85c6a3d3325a8b3ab428c9c1f76bc6d1b651c879fa97d59223451cdcd","eb71b8b3341c222f144cf32f42f9b9148d7b627e5b3c6103a5f3ac56c560a158","ef99471758dc73c45801a60d26307bb516d10f89e5903c91c5eff672e932ccb1","bdb4c178a8f8ff60adafd15d70fdf6b46d3c6f81f6df1e3e7a28591f469a387d","347038ff8218327f04a203e94b4d6aa0880e03c595d8b216f5d937d0cf399fd2","fd0f0447797aed4a9ca12bc550431dc5e3abfd8457ae4aa097d8f33edee28e98","a31b2eb749842299eea366c746b942d1b701d10468e3fea0d5d4ec995d26247b","2fcd2d22b1f30555e785105597cd8f57ed50300e213c4f1bbca6ae149f782c38",{"version":"bb4248c7f953233ac52332088fac897d62b82be07244e551d87c5049600b6cf7","affectsGlobalScope":true},"86fd1a4f883c8f923441b8e6c87a2dca5e9821686034bc16ff2fa47a78d490e6","f6b34ae1d3cb81d3c650290d01bc9c594b8fc04cfbc36d80d53cdf383f2e1233","bfe6237b2761c335b61c7fe90fa3e451e582d5ff1109b9225f1e188dd59efd57","a494399a814393efdcd4066904822d0292e7b999bca3fc91478b0f4bad64967b","74e89ad35934a9146c55e67657e23447a56f06ee0273eb44ddf0d248e9d67fcd","3077b10aeb84262b97adbd643e603ee5db682f2fdb8ea7b61fbc44bf3513462c","06ed91e3b43a8b7a1c2fe5ae698244083a09573c55eb2817b469f92bbd69900e","0a2ab125850824d588017693993458942c0fe8a8fc3b7f1dfea12f4065d44511","cff7b50265c69c4af0eb722967d95c9049dd081682aec6ad3b9207e7301c318b","0f6c3917f03c518a3c0b899c8eae3ecd974fd32f88dcbb09671c206af6d18db4","4f708365069dd7e37e068756288d8c0b6846e58b4c1b17a1260c81f9654a6114","2b8c3d99f7826bb04073c2d4598af76ff698ad537fe9fa9bb74c08e461e1b860","46d840d793a2023a227f092e903a4e94f75e92aa5be111e45010aaec4e027cf0",{"version":"4064f01a811057d60392c99f45121db2523d38cb68ac8769602faea41e6e9b86","affectsGlobalScope":true},"58a16eaa92a162dfc251db07f04b8511e6a07eaf558563634b3c8ecc7d908d5b","128871d766b4ce78cdd5ba772e30b699ff69f5e38954101654f9deb25a6df454","f726c565fa43df3f3d8f44aa920434fa417898d72fda1b51ba98f91e42e039ce","ccf4459c9b3a8443fad5a944b6d7c0867ad95e054967d5859a41178ae6022b56",{"version":"109b47aaf8cff564cce2606003778b2b688d849196656e34e134287b08d45ad8","affectsGlobalScope":true},"3210eb31e629ed09089bdc47a79fe368a7458f7a357fe4ed06089dccadc95446","057a2169f1a05182e4fa5f10b170e4d0c5182ff9dc67e3a428e39fe616cf3c11","89ccbe04e737ce613f5f04990271cfa84901446350b8551b0555ddf19319723b","a185ebc69c9f6798ebd67bfdfd72a37457dc67c23459784783c7128ae9bd5250","cddf5c26907c0b8378bc05543161c11637b830da9fadf59e02a11e675d11e180","36b374bda8f87b67816ce80a538b52350b37357b77b6baf9b5b48cfe54ca540d","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380",{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"4ee363f83d7be2202f34fcd84c44da71bf3a9329fee8a05f976f75083a52ea94","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"2f1fdc948954bec1253759db6b57952133e38ebb33c990c8d2c81d8ee0b8eea7","affectsGlobalScope":true},"b4dfafe583b829a382edccbe32303535d0785f0c02ba7f04418e2a81de97af8a","8a19491eba2108d5c333c249699f40aff05ad312c04a17504573b27d91f0aede","74b0245c42990ed8a849df955db3f4362c81b13f799ebc981b7bec2d5b414a57"],"options":{"declaration":true,"downlevelIteration":true,"emitDeclarationOnly":false,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"importHelpers":true,"inlineSourceMap":false,"inlineSources":true,"module":99,"noEmitHelpers":true,"noEmitOnError":false,"noFallthroughCasesInSwitch":true,"noImplicitAny":false,"noImplicitReturns":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"target":5},"fileIdsList":[[69,70],[69,70,90],[69,70,89],[69,70,147],[69,70,94],[69,70,92,147],[50,69,70,93,147],[69,70,92,93],[69,70,103],[69,70,103,147],[50,69,70,96,97,98,99,100,101,102,103,147],[69,70,85,86,87,88,91,95,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146],[69,70,111,147],[69,70,147,151],[39,69,70,147],[69,70,162],[69,70,186],[69,70,83],[35,69,70,83],[37,69,70],[69,70,82,83],[38,43,69,70],[39,49,50,57,66,69,70],[39,40,49,57,69,70],[41,69,70,75],[42,43,50,58,69,70],[43,66,69,70,71],[44,46,49,57,69,70],[45,69,70],[46,47,69,70],[48,49,69,70],[49,69,70],[49,50,51,66,69,70,74],[49,50,51,66,69,70],[52,57,66,69,70,74],[49,50,52,53,57,66,69,70,71,74],[52,54,69,70,71,74],[69,70,84],[49,55,69,70],[56,69,70,74],[46,49,57,66,69,70],[58,69,70],[59,69,70],[37,60,69,70],[61,69,70,73,78],[62,69,70],[63,69,70],[49,64,69,70],[64,65,69,70,75,77],[49,66,67,69,70],[66,67,69,70],[68,69,70],[69],[43,57,69,70,71],[69,70,72],[35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81],[57,69,70,73],[52,63,69,70,74],[43,69,70,75],[66,69,70,76],[69,70,77],[69,70,81],[38,43,49,51,60,66,69,70,74,77,78],[66,69,70,79],[69,70,193],[69,70,189,190,191,192],[69,70,85],[69,70,161],[69,70,147,169],[69,70,148],[69,70,147,148],[69,70,147,152],[69,70,147,165],[69,70,148,149,150,153,154,155,156,157,158,159,160,164,165,166,167,168],[69,70,163],[69,70,147,148,165],[69,70,147,181],[34,69,70,147,171,175,179],[34,69,70,182],[34,69,70],[34,69,70,147,169,170,171,172,173,174],[34,69,70,147],[34,69,70,147,170,177],[34,69,70,147,169,170,175,176,178],[34,69,70,147,169]],"referencedMap":[[88,1],[91,2],[90,3],[89,4],[95,5],[93,6],[92,7],[94,8],[104,9],[97,10],[96,10],[98,9],[100,10],[99,10],[101,1],[102,9],[103,11],[147,12],[151,13],[152,14],[86,4],[105,4],[106,15],[107,1],[108,1],[109,4],[111,14],[110,4],[112,4],[113,4],[114,4],[115,4],[116,4],[117,1],[118,4],[119,4],[120,4],[121,4],[122,4],[123,4],[124,4],[126,4],[125,4],[127,4],[129,4],[128,4],[130,4],[131,4],[132,4],[133,4],[134,1],[135,4],[136,4],[137,4],[139,4],[87,4],[140,4],[138,4],[141,4],[143,4],[142,1],[144,4],[146,4],[145,4],[163,16],[184,1],[181,1],[185,1],[187,17],[83,18],[35,19],[37,20],[84,21],[38,22],[39,23],[40,24],[41,25],[42,26],[43,27],[44,28],[45,29],[46,30],[47,30],[48,31],[49,32],[50,33],[51,34],[36,1],[80,1],[52,35],[53,36],[54,37],[85,38],[55,39],[56,40],[57,41],[58,42],[59,43],[60,44],[61,45],[62,46],[63,47],[64,48],[65,49],[66,50],[67,51],[68,52],[69,32],[70,53],[71,54],[72,55],[82,56],[73,57],[74,58],[75,59],[76,60],[77,61],[81,62],[78,63],[79,64],[188,1],[189,1],[194,65],[190,1],[193,66],[195,67],[196,1],[192,1],[162,68],[161,1],[186,1],[173,69],[149,70],[150,71],[153,72],[166,73],[154,4],[168,1],[155,4],[156,71],[157,71],[158,4],[169,74],[164,75],[159,4],[167,76],[160,4],[165,4],[148,1],[182,77],[191,1],[172,1],[34,1],[7,1],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[1,1],[33,1],[180,78],[183,79],[179,80],[175,81],[176,80],[171,82],[178,83],[177,84],[170,85],[174,80]],"exportedModulesMap":[[88,1],[91,2],[90,3],[89,4],[95,5],[93,6],[92,7],[94,8],[104,9],[97,10],[96,10],[98,9],[100,10],[99,10],[101,1],[102,9],[103,11],[147,12],[151,13],[152,14],[86,4],[105,4],[106,15],[107,1],[108,1],[109,4],[111,14],[110,4],[112,4],[113,4],[114,4],[115,4],[116,4],[117,1],[118,4],[119,4],[120,4],[121,4],[122,4],[123,4],[124,4],[126,4],[125,4],[127,4],[129,4],[128,4],[130,4],[131,4],[132,4],[133,4],[134,1],[135,4],[136,4],[137,4],[139,4],[87,4],[140,4],[138,4],[141,4],[143,4],[142,1],[144,4],[146,4],[145,4],[163,16],[184,1],[181,1],[185,1],[187,17],[83,18],[35,19],[37,20],[84,21],[38,22],[39,23],[40,24],[41,25],[42,26],[43,27],[44,28],[45,29],[46,30],[47,30],[48,31],[49,32],[50,33],[51,34],[36,1],[80,1],[52,35],[53,36],[54,37],[85,38],[55,39],[56,40],[57,41],[58,42],[59,43],[60,44],[61,45],[62,46],[63,47],[64,48],[65,49],[66,50],[67,51],[68,52],[69,32],[70,53],[71,54],[72,55],[82,56],[73,57],[74,58],[75,59],[76,60],[77,61],[81,62],[78,63],[79,64],[188,1],[189,1],[194,65],[190,1],[193,66],[195,67],[196,1],[192,1],[162,68],[161,1],[186,1],[173,69],[149,70],[150,71],[153,72],[166,73],[154,4],[168,1],[155,4],[156,71],[157,71],[158,4],[169,74],[164,75],[159,4],[167,76],[160,4],[165,4],[148,1],[182,77],[191,1],[172,1],[34,1],[7,1],[9,1],[8,1],[2,1],[10,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[3,1],[4,1],[21,1],[18,1],[19,1],[20,1],[22,1],[23,1],[24,1],[5,1],[25,1],[26,1],[27,1],[28,1],[6,1],[29,1],[30,1],[31,1],[32,1],[1,1],[33,1],[180,78],[183,79],[179,80],[175,81],[176,80],[171,82],[178,83],[177,84],[170,85],[174,80]],"semanticDiagnosticsPerFile":[88,91,90,89,95,93,92,94,104,97,96,98,100,99,101,102,103,147,151,152,86,105,106,107,108,109,111,110,112,113,114,115,116,117,118,119,120,121,122,123,124,126,125,127,129,128,130,131,132,133,134,135,136,137,139,87,140,138,141,143,142,144,146,145,163,184,181,185,187,83,35,37,84,38,39,40,41,42,43,44,45,46,47,48,49,50,51,36,80,52,53,54,85,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,82,73,74,75,76,77,81,78,79,188,189,194,190,193,195,196,192,162,161,186,173,149,150,153,166,154,168,155,156,157,158,169,164,159,167,160,165,148,182,191,172,34,7,9,8,2,10,11,12,13,14,15,16,17,3,4,21,18,19,20,22,23,24,5,25,26,27,28,6,29,30,31,32,1,33,180,183,179,175,176,171,178,177,170,174]},"version":"4.3.5"} \ No newline at end of file diff --git a/package.json b/package.json index 7315f91..5c49d0b 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Code Formatting for Atom IDE", "repository": "https://github.com/atom-community/atom-ide-code-format", "main": "./dist/main.js", - "version": "1.0.1", + "version": "1.0.2", "description": "Provides a code-formatting provider API", "scripts": { "format": "prettier --write .",