Gruntfuggly / activitusbar

A VSCode extension to save some real estate by recreating the activity bar buttons on the status bar
Other
114 stars 15 forks source link

File create/rename loses focus #44

Closed bbros-dev closed 3 years ago

bbros-dev commented 3 years ago

When attempting to create or edit a file/folder the text area to (re)name loses focus and the task cannot be completed.

VSCode extension bisect identified this extension as the source of the behavior:

A/B Experiment Info:

vsliv368:30146709
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
pythonvspyt639:30300192
pythontb:30283811
vspre833:30267464
pythonptprofiler:30281270
vshan820:30294714
pythondataviewer:30285071
vscus158cf:30286554
bridgeflightcf:30299255

system Info:


CPUs | Intel(R) Celeron(R) CPU G550T @ 2.20GHz (2 x 2195)
-- | --
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: disabled_off oop_rasterization: disabled_off opengl: enabled_on rasterization: disabled_software skia_renderer: enabled_on video_decode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled
Load (avg) | 5, 7, 6
Memory (System) | 15.51GB (3.48GB free)
Process Argv | --no-sandbox --unity-launch --crash-reporter-id 297ecd66-bd98-4ad0-b7be-4fdb48d7f2b5
Screen Reader | no
VM | 0%
Gruntfuggly commented 3 years ago

Please could you add some steps to reproduce? The extension adds buttons to the status bar - I don't see how it can interact with the file name field.

bbros-dev commented 3 years ago

Apologies I tried using the VSCode reporting tool but it failed to generate the issue report.

With the following list of extensions I observe this behavior. The VSCode extension bisect tool tagged this extension as the extension that triggered the issue.

code --install-extension bbenoist.vagrant --force &&
code --install-extension brunnerh.insert-unicode --force &&
code --install-extension budparr.language-hugo-vscode --force &&
code --install-extension bungcip.better-toml --force &&
code --install-extension burtlo.inspec --force &&
code --install-extension castwide.solargraph --force &&
code --install-extension chef-software.chef --force &&
code --install-extension CoenraadS.bracket-pair-colorizer --force &&
code --install-extension DavidAnson.vscode-markdownlint --force &&
code --install-extension donjayamanne.githistory --force &&
code --install-extension eamodio.gitlens --force &&
code --install-extension errata-ai.vale-server --force &&
code --install-extension esbenp.prettier-vscode --force &&
code --install-extension EugenWiens.bitbake --force &&
code --install-extension felipecaputo.git-project-manager --force &&
code --install-extension fernandoescolar.vscode-solution-explorer --force &&
code --install-extension formulahendry.code-runner --force &&
code --install-extension ginfuru.ginfuru-better-solarized-dark-theme --force &&
code --install-extension GitHub.vscode-pull-request-github --force &&
code --install-extension golang.go --force &&
code --install-extension Gruntfuggly.activitusbar --force &&
code --install-extension hashicorp.terraform --force &&
code --install-extension humao.rest-client --force &&
code --install-extension Ikuyadeu.r --force &&
code --install-extension James-Yu.latex-workshop --force &&
code --install-extension jetmartin.bats --force &&
code --install-extension jirkafajfr.vscode-kitchen --force &&
code --install-extension joaompinto.vscode-graphviz --force &&
code --install-extension jock.svg --force &&
code --install-extension julialang.language-julia --force &&
code --install-extension marcostazi.VS-code-vagrantfile --force &&
code --install-extension matklad.rust-analyzer --force &&
code --install-extension mdickin.markdown-shortcuts --force &&
code --install-extension mervin.markdown-formatter --force &&
code --install-extension mhutchie.git-graph --force &&
code --install-extension misogi.ruby-rubocop --force &&
code --install-extension moshfeu.compare-folders --force &&
code --install-extension ms-azuretools.vscode-docker --force &&
code --install-extension ms-dotnettools.csharp --force &&
code --install-extension ms-python.python --force &&
code --install-extension ms-python.vscode-pylance --force &&
code --install-extension ms-toolsai.jupyter --force &&
code --install-extension ms-vscode.cpptools --force &&
code --install-extension mtxr.sqltools --force &&
code --install-extension mtxr.sqltools-driver-pg --force &&
code --install-extension naumovs.color-highlight --force &&
code --install-extension rebornix.ruby --force &&
code --install-extension redhat.vscode-yaml --force &&
code --install-extension rogalmic.bash-debug --force &&
code --install-extension serayuzgur.crates --force &&
code --install-extension sleistner.vscode-fileutils --force &&
code --install-extension statiolake.vscode-rustfmt --force &&
code --install-extension streetsidesoftware.code-spell-checker --force &&
code --install-extension stuart.unique-window-colors --force &&
code --install-extension tecosaur.latex-utilities --force &&
code --install-extension timonwong.shellcheck --force &&
code --install-extension vadimcn.vscode-lldb --force &&
code --install-extension vscode-icons-team.vscode-icons --force &&
code --install-extension wholroyd.HCL --force &&
code --install-extension wingrunr21.vscode-ruby --force
Gruntfuggly commented 3 years ago

Please could you describe how to reproduce the problem? If I use add file or add folder it works fine.

Please list the steps, i.e what buttons you are pressing and what happens at each stage.

A screenshot would also be really useful.

bbros-dev commented 3 years ago

Selecting/pressing the "New file" or "New folder" icon in the file explorer pane should trigger it. Fitting F2 on a file should also trigger it.

To reproduce: I've noticed that the issue isn't triggered in an empty workspace. So, I believe at least the Go and Rust extensions should be 'actively in use' i.e. enabled is not enough - maybe others too....?

Is there are way to query which extensions are actively in use when you open a project?

VSCode bisect always shows this extension as the source of the behavior.

bbros-dev commented 3 years ago

OK I can trigger and stop this at will by using the Rust analyzer plugin to trigger file events.

Specifically, omit .git from the "Files: Watcher Exclude" list

The Dev console for VSCode should be spammed by the following types of messages:

....
[Extension Host] Event[file] 2 - /home/[redacted]/src/nmio/.git/modules/web/docs/themes/docsy/index.lock
workbench.desktop.main.js:62 [Extension Host] Event[file] 0 - /home/[redacted]/src/nmio/.git/index.lock
workbench.desktop.main.js:62 [Extension Host] Event[file] 0 - /home/[redacted]/src/nmio/.git/modules/web/docs/themes/docsy/index.lock
workbench.desktop.main.js:62 [Extension Host] Event[file] 2 - /home/[redacted]/src/nmio/.git/index.lock
workbench.desktop.main.js:62 
....

Try to create new file/folder or rename a file and you should loose focus before you are able to complete the task.

Now add this setting (as an alternative to disabling this extension):

"files.watcherExclude": {
  "**/.git/**": true,
}

The dev console should no longer be spammed, and new file/new folder/rename activities can complete.

It would appear this extension interacts with some file events to expose this behavior?

bbros-dev commented 3 years ago

The extension adds buttons to the status bar - I don't see how it can interact with the file name field.

This had me puzzled to, but it is likely related to the file events - identified above - since the git "button" that activitus adds shows the counts of edited files, and this is updated in the background without user input (i.e. I don't have to hit refresh/F5 to see the count of changes)?

Of course I'm just guessing at this stage.

bbros-dev commented 3 years ago

I wonder if this was trigger by issue #43?

It would explain why I'm only recently observing this behavior while the repository affected has not had its Rust related configuration changed for 1+month.

Gruntfuggly commented 3 years ago

I expect you've already tried, but does it still happen when activitusbar.showSourceControlCounter is set to false?

Also, could you try installing the previous version of the extension and check if it still happens?

bbros-dev commented 3 years ago

Okay:

  1. Remove **.git** from file watcher exclude list
  2. Console is spammed with file events
  3. new file/folder and rename lose focus
  4. Set activitusbar.showSourceControlCounter to false
  5. Console stops being spammed with file events
  6. new file/folder and rename work as expected

So it seems the implementation of #43 is the source of this behavior? Thanks for the tip about activitusbar.showSourceControlCounter, since I can workaround this issue by deactivating the source control counter in this extension, I haven't tried the old version.

Gruntfuggly commented 3 years ago

Thanks for you work investigating it. This version introduced the monitoring to update the counter, so the older version should work as expected.

The only thing that happens when the count is processed is that the status bar item is changed, which shouldn't have any effect on focus.

This extension shouldn't be logging anything when its file watcher detects changes. Can you see what is generating the messages to the console? Could you post a screenshot of the console messages?

I'm guessing that another extension is being triggered by the output maybe.

bbros-dev commented 3 years ago

The defining characteristic appears to be a flood of the .git/index.lock file events.
And the source is always workbench.desktop.main.js:62, which is shown at the end of this comment - it breaks GH formatting.

All cases where file/folder new and (re)name work show a small number of these events. The project where it does not work shows a flood of these events.

Unfortunately commercial restrictions mean I can't post anything related to the project where this occurs.
The closest I can find in my OSS repo's is the zero2production repository, the adversely affected project shows a console similar to the following with an order of magnitude more occurrences of .git/index.lock:

image

\`);return g===-1?w:w.substring(0,g)}function S(w,g){const{args:C,stack:l}=L(w),m=typeof C[0]=="string"&&C.length===1;let u=T(l);u&&(u=`(${u.trim()})`);let p=[];if(typeof C[0]=="string"?u&&m?p=[`%c[${g}] %c${C[0]} %c${u}`,E("blue"),E(""),E("grey")]:p=[`%c[${g}] %c${C[0]}`,E("blue"),E(""),...C.slice(1)]:p=[`%c[${g}]%`,E("blue"),...C],u&&!m&&p.push(u),typeof console[w.severity]!="function")throw new Error("Unknown console method");console[w.severity].apply(console,p)}e.log=S;function E(w){return`color: ${w}`}});var Mt=this&&this.__classPrivateFieldSet||function(Z,e,t,I,L){if(I==="m")throw new TypeError("Private method is not writable");if(I==="a"&&!L)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?Z!==e||!L:!e.has(Z))throw new TypeError("Cannot write private member to an object whose class did not declare it");return I==="a"?L.call(Z,t):L?L.value=t:e.set(Z,t),t},kt=this&&this.__classPrivateFieldGet||function(Z,e,t,I){if(t==="a"&&!I)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?Z!==e||!I:!e.has(Z))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?I:t==="a"?I.call(Z):I?I.value:e.get(Z)};define(ie[64],ne([0,1,8,30]),function(Z,e,t,I){"use strict";var L,R,T;Object.defineProperty(e,"__esModule",{value:!0}),e.ReadonlyMapView=e.LRUCache=e.LinkedMap=e.Touch=e.ResourceMap=e.TernarySearchTree=e.UriIterator=e.PathIterator=e.ConfigKeysIterator=e.StringIterator=e.setToString=e.mapToString=e.getOrSet=void 0;function S(i,r,h){let f=i.get(r);return f===void 0&&(f=h,i.set(r,f)),f}e.getOrSet=S;function E(i){const r=[];return i.forEach((h,f)=>{r.push(`${f} => ${h}`)}),`Map(${i.size}) {${r.join(", ")}}`}e.mapToString=E;function w(i){const r=[];return i.forEach(h=>{r.push(h)}),`Set(${i.size}) {${r.join(", ")}}`}e.setToString=w;class g{constructor(){this._value="",this._pos=0}reset(r){return this._value=r,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(r){const h=r.charCodeAt(0),f=this._value.charCodeAt(this._pos);return h-f}value(){return this._value[this._pos]}}e.StringIterator=g;class C{constructor(r=!0){this._caseSensitive=r}reset(r){return this._value=r,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let r=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(r)this._from++;else break;else r=!1;return this}cmp(r){return this._caseSensitive?(0,I.compareSubstring)(r,this._value,0,r.length,this._from,this._to):(0,I.compareSubstringIgnoreCase)(r,this._value,0,r.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}e.ConfigKeysIterator=C;class l{constructor(r=!0,h=!0){this._splitOnBackslash=r,this._caseSensitive=h}reset(r){return this._value=r.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let r=!0;for(;this._to<this._value.length;this._to++){const h=this._value.charCodeAt(this._to);if(h===47||this._splitOnBackslash&&h===92)if(r)this._from++;else break;else r=!1}return this}cmp(r){return this._caseSensitive?(0,I.compareSubstring)(r,this._value,0,r.length,this._from,this._to):(0,I.compareSubstringIgnoreCase)(r,this._value,0,r.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}e.PathIterator=l;var m;(function(i){i[i.Scheme=1]="Scheme",i[i.Authority=2]="Authority",i[i.Path=3]="Path",i[i.Query=4]="Query",i[i.Fragment=5]="Fragment"})(m||(m={}));class u{constructor(r){this._ignorePathCasing=r,this._states=[],this._stateIdx=0}reset(r){return this._value=r,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new l(!1,!this._ignorePathCasing(r)),this._pathIterator.reset(r.path),this._pathIterator.value()&&this._states.push(3)),this._value.query&&this._states.push(4),this._value.fragment&&this._states.push(5),this._stateIdx=0,this}next(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()?this._pathIterator.next():this._stateIdx+=1,this}hasNext(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()||this._stateIdx<this._states.length-1}cmp(r){if(this._states[this._stateIdx]===1)return(0,I.compareIgnoreCase)(r,this._value.scheme);if(this._states[this._stateIdx]===2)return(0,I.compareIgnoreCase)(r,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(r);if(this._states[this._stateIdx]===4)return(0,I.compare)(r,this._value.query);if(this._states[this._stateIdx]===5)return(0,I.compare)(r,this._value.fragment);throw new Error}value(){if(this._states[this._stateIdx]===1)return this._value.scheme;if(this._states[this._stateIdx]===2)return this._value.authority;if(this._states[this._stateIdx]===3)return this._pathIterator.value();if(this._states[this._stateIdx]===4)return this._value.query;if(this._states[this._stateIdx]===5)return this._value.fragment;throw new Error}}e.UriIterator=u;class p{isEmpty(){return!this.left&&!this.mid&&!this.right&&!this.value}}class a{constructor(r){this._iter=r}static forUris(r=()=>!1){return new a(new u(r))}static forPaths(){return new a(new l)}static forStrings(){return new a(new g)}static forConfigKeys(){return new a(new C)}clear(){this._root=void 0}set(r,h){const f=this._iter.reset(r);let v;for(this._root||(this._root=new p,this._root.segment=f.value()),v=this._root;;){const y=f.cmp(v.segment);if(y>0)v.left||(v.left=new p,v.left.segment=f.value()),v=v.left;else if(y<0)v.right||(v.right=new p,v.right.segment=f.value()),v=v.right;else if(f.hasNext())f.next(),v.mid||(v.mid=new p,v.mid.segment=f.value()),v=v.mid;else break}const b=v.value;return v.value=h,v.key=r,b}get(r){var h;return(h=this._getNode(r))===null||h===void 0?void 0:h.value}_getNode(r){const h=this._iter.reset(r);let f=this._root;for(;f;){const v=h.cmp(f.segment);if(v>0)f=f.left;else if(v<0)f=f.right;else if(h.hasNext())h.next(),f=f.mid;else break}return f}has(r){const h=this._getNode(r);return!((h==null?void 0:h.value)===void 0&&(h==null?void 0:h.mid)===void 0)}delete(r){return this._delete(r,!1)}deleteSuperstr(r){return this._delete(r,!0)}_delete(r,h){const f=this._iter.reset(r),v=[];let b=this._root;for(;b;){const y=f.cmp(b.segment);if(y>0)v.push([1,b]),b=b.left;else if(y<0)v.push([-1,b]),b=b.right;else if(f.hasNext())f.next(),v.push([0,b]),b=b.mid;else{for(h?(b.left=void 0,b.mid=void 0,b.right=void 0):b.value=void 0;v.length>0&&b.isEmpty();){let[_,D]=v.pop();switch(_){case 1:D.left=void 0;break;case 0:D.mid=void 0;break;case-1:D.right=void 0;break}b=D}break}}}findSubstr(r){const h=this._iter.reset(r);let f=this._root,v;for(;f;){const b=h.cmp(f.segment);if(b>0)f=f.left;else if(b<0)f=f.right;else if(h.hasNext())h.next(),v=f.value||v,f=f.mid;else break}return f&&f.value||v}findSuperstr(r){const h=this._iter.reset(r);let f=this._root;for(;f;){const v=h.cmp(f.segment);if(v>0)f=f.left;else if(v<0)f=f.right;else if(h.hasNext())h.next(),f=f.mid;else return f.mid?this._entries(f.mid):void 0}}forEach(r){for(const[h,f]of this)r(f,h)}*[Symbol.iterator](){yield*this._entries(this._root)}*_entries(r){r&&(yield*this._entries(r.left),r.value&&(yield[r.key,r.value]),yield*this._entries(r.mid),yield*this._entries(r.right))}}e.TernarySearchTree=a;class c{constructor(r,h){this[L]="ResourceMap",r instanceof c?(this.map=new Map(r.map),this.toKey=h!=null?h:c.defaultToKey):(this.map=new Map,this.toKey=r!=null?r:c.defaultToKey)}set(r,h){return this.map.set(this.toKey(r),h),this}get(r){return this.map.get(this.toKey(r))}has(r){return this.map.has(this.toKey(r))}get size(){return this.map.size}clear(){this.map.clear()}delete(r){return this.map.delete(this.toKey(r))}forEach(r,h){typeof h!="undefined"&&(r=r.bind(h));for(let[f,v]of this.map)r(v,t.URI.parse(f),this)}values(){return this.map.values()}*keys(){for(let r of this.map.keys())yield t.URI.parse(r)}*entries(){for(let r of this.map.entries())yield[t.URI.parse(r[0]),r[1]]}*[(L=Symbol.toStringTag,Symbol.iterator)](){for(let r of this.map)yield[t.URI.parse(r[0]),r[1]]}}e.ResourceMap=c,c.defaultToKey=i=>i.toString();var o;(function(i){i[i.None=0]="None",i[i.AsOld=1]="AsOld",i[i.AsNew=2]="AsNew"})(o=e.Touch||(e.Touch={}));class s{constructor(){this[R]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var r;return(r=this._head)===null||r===void 0?void 0:r.value}get last(){var r;return(r=this._tail)===null||r===void 0?void 0:r.value}has(r){return this._map.has(r)}get(r,h=0){const f=this._map.get(r);if(!!f)return h!==0&&this.touch(f,h),f.value}set(r,h,f=0){let v=this._map.get(r);if(v)v.value=h,f!==0&&this.touch(v,f);else{switch(v={key:r,value:h,next:void 0,previous:void 0},f){case 0:this.addItemLast(v);break;case 1:this.addItemFirst(v);break;case 2:this.addItemLast(v);break;default:this.addItemLast(v);break}this._map.set(r,v),this._size++}return this}delete(r){return!!this.remove(r)}remove(r){const h=this._map.get(r);if(!!h)return this._map.delete(r),this.removeItem(h),this._size--,h.value}shift(){if(!(!this._head&&!this._tail)){if(!this._head||!this._tail)throw new Error("Invalid list");const r=this._head;return this._map.delete(r.key),this.removeItem(r),this._size--,r.value}}forEach(r,h){const f=this._state;let v=this._head;for(;v;){if(h?r.bind(h)(v.value,v.key,this):r(v.value,v.key,this),this._state!==f)throw new Error("LinkedMap got modified during iteration.");v=v.next}}keys(){const r=this,h=this._state;let f=this._head;const v={[Symbol.iterator](){return v},next(){if(r._state!==h)throw new Error("LinkedMap got modified during iteration.");if(f){const b={value:f.key,done:!1};return f=f.next,b}else return{value:void 0,done:!0}}};return v}values(){const r=this,h=this._state;let f=this._head;const v={[Symbol.iterator](){return v},next(){if(r._state!==h)throw new Error("LinkedMap got modified during iteration.");if(f){const b={value:f.value,done:!1};return f=f.next,b}else return{value:void 0,done:!0}}};return v}entries(){const r=this,h=this._state;let f=this._head;const v={[Symbol.iterator](){return v},next(){if(r._state!==h)throw new Error("LinkedMap got modified during iteration.");if(f){const b={value:[f.key,f.value],done:!1};return f=f.next,b}else return{value:void 0,done:!0}}};return v}[(R=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(r){if(!(r>=this.size)){if(r===0){this.clear();return}let h=this._head,f=this.size;for(;h&&f>r;)this._map.delete(h.key),h=h.next,f--;this._head=h,this._size=f,h&&(h.previous=void 0),this._state++}}addItemFirst(r){if(!this._head&&!this._tail)this._tail=r;else if(this._head)r.next=this._head,this._head.previous=r;else throw new Error("Invalid list");this._head=r,this._state++}addItemLast(r){if(!this._head&&!this._tail)this._head=r;else if(this._tail)r.previous=this._tail,this._tail.next=r;else throw new Error("Invalid list");this._tail=r,this._state++}removeItem(r){if(r===this._head&&r===this._tail)this._head=void 0,this._tail=void 0;else if(r===this._head){if(!r.next)throw new Error("Invalid list");r.next.previous=void 0,this._head=r.next}else if(r===this._tail){if(!r.previous)throw new Error("Invalid list");r.previous.next=void 0,this._tail=r.previous}else{const h=r.next,f=r.previous;if(!h||!f)throw new Error("Invalid list");h.previous=f,f.next=h}r.next=void 0,r.previous=void 0,this._state++}touch(r,h){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(h!==1&&h!==2)){if(h===1){if(r===this._head)return;const f=r.next,v=r.previous;r===this._tail?(v.next=void 0,this._tail=v):(f.previous=v,v.next=f),r.previous=void 0,r.next=this._head,this._head.previous=r,this._head=r,this._state++}else if(h===2){if(r===this._tail)return;const f=r.next,v=r.previous;r===this._head?(f.previous=void 0,this._head=f):(f.previous=v,v.next=f),r.next=void 0,r.previous=this._tail,this._tail.next=r,this._tail=r,this._state++}}}toJSON(){const r=[];return this.forEach((h,f)=>{r.push([f,h])}),r}fromJSON(r){this.clear();for(const[h,f]of r)this.set(h,f)}}e.LinkedMap=s;class n extends s{constructor(r,h=1){super();this._limit=r,this._ratio=Math.min(Math.max(0,h),1)}get limit(){return this._limit}set limit(r){this._limit=r,this.checkTrim()}get ratio(){return this._ratio}set ratio(r){this._ratio=Math.min(Math.max(0,r),1),this.checkTrim()}get(r,h=2){return super.get(r,h)}peek(r){return super.get(r,0)}set(r,h){return super.set(r,h,2),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}e.LRUCache=n;class d{constructor(r){T.set(this,void 0),Mt(this,T,r,"f")}get size(){return kt(this,T,"f").size}forEach(r,h){kt(this,T,"f").forEach(r,h)}get(r){return kt(this,T,"f").get(r)}has(r){return kt(this,T,"f").has(r)}entries(){return kt(this,T,"f").entries()}keys(){return kt(this,T,"f").keys()}values(){return kt(this,T,"f").values()}[(T=new WeakMap,Symbol.iterator)](){return kt(this,T,"f").entries()}}e.ReadonlyMapView=d}),define(ie[98],ne([0,1,64,30]),function(Z,e,t,I){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fuzzyScoreGraceful=e.fuzzyScoreGracefulAggressive=e.fuzzyScore=e.FuzzyScore=e.isPatternInWord=e.createMatches=e.anyScore=e.matchesFuzzy2=e.matchesFuzzy=e.matchesWords=e.matchesCamelCase=e.isUpper=e.matchesSubString=e.matchesContiguousSubString=e.matchesPrefix=e.matchesStrictPrefix=e.or=void 0;function L(...he){return function(te,le){for(let ce=0,ge=he.length;ce<ge;ce++){const ae=he[ce](te,le);if(ae)return ae}return null}}e.or=L,e.matchesStrictPrefix=R.bind(void 0,!1),e.matchesPrefix=R.bind(void 0,!0);function R(he,te,le){if(!le||le.length<te.length)return null;let ce;return he?ce=I.startsWithIgnoreCase(le,te):ce=le.indexOf(te)===0,ce?te.length>0?[{start:0,end:te.length}]:[]:null}function T(he,te){const le=te.toLowerCase().indexOf(he.toLowerCase());return le===-1?null:[{start:le,end:le+he.length}]}e.matchesContiguousSubString=T;function S(he,te){return E(he.toLowerCase(),te.toLowerCase(),0,0)}e.matchesSubString=S;function E(he,te,le,ce){if(le===he.length)return[];if(ce===te.length)return null;if(he[le]===te[ce]){let ge=null;return(ge=E(he,te,le+1,ce+1))?c({start:ce,end:ce+1},ge):null}return E(he,te,le,ce+1)}function w(he){return 97<=he&&he<=122}function g(he){return 65<=he&&he<=90}e.isUpper=g;function C(he){return 48<=he&&he<=57}function l(he){return he===32||he===9||he===10||he===13}const m=new Set;"`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?".split("").forEach(he=>m.add(he.charCodeAt(0)));function u(he){return l(he)||m.has(he)}function p(he,te){return he===te||u(he)&&u(te)}function a(he){return w(he)||g(he)||C(he)}function c(he,te){return te.length===0?te=[he]:he.end===te[0].start?te[0].start=he.start:te.unshift(he),te}function o(he,te){for(let le=te;le<he.length;le++){const ce=he.charCodeAt(le);if(g(ce)||C(ce)||le>0&&!a(he.charCodeAt(le-1)))return le}return he.length}function s(he,te,le,ce){if(le===he.length)return[];if(ce===te.length)return null;if(he[le]!==te[ce].toLowerCase())return null;{let ge=null,ae=ce+1;for(ge=s(he,te,le+1,ce+1);!ge&&(ae=o(te,ae))<te.length;)ge=s(he,te,le+1,ae),ae++;return ge===null?null:c({start:ce,end:ce+1},ge)}}function n(he){let te=0,le=0,ce=0,ge=0,ae=0;for(let we=0;we<he.length;we++)ae=he.charCodeAt(we),g(ae)&&te++,w(ae)&&le++,a(ae)&&ce++,C(ae)&&ge++;const se=te/he.length,oe=le/he.length,fe=ce/he.length,ve=ge/he.length;return{upperPercent:se,lowerPercent:oe,alphaPercent:fe,numericPercent:ve}}function d(he){const{upperPercent:te,lowerPercent:le}=he;return le===0&&te>.6}function i(he){const{upperPercent:te,lowerPercent:le,alphaPercent:ce,numericPercent:ge}=he;return le>.2&&te<.8&&ce>.6&&ge<.2}function r(he){let te=0,le=0,ce=0,ge=0;for(let ae=0;ae<he.length;ae++)ce=he.charCodeAt(ae),g(ce)&&te++,w(ce)&&le++,l(ce)&&ge++;return(te===0||le===0)&&ge===0?he.length<=30:te<=5}function h(he,te){if(!te||(te=te.trim(),te.length===0)||!r(he)||te.length>60)return null;const le=n(te);if(!i(le)){if(!d(le))return null;te=te.toLowerCase()}let ce=null,ge=0;for(he=he.toLowerCase();ge<te.length&&(ce=s(he,te,0,ge))===null;)ge=o(te,ge+1);return ce}e.matchesCamelCase=h;function f(he,te,le=!1){if(!te||te.length===0)return null;let ce=null,ge=0;for(he=he.toLowerCase(),te=te.toLowerCase();ge<te.length&&(ce=v(he,te,0,ge,le))===null;)ge=b(te,ge+1);return ce}e.matchesWords=f;function v(he,te,le,ce,ge){if(le===he.length)return[];if(ce===te.length)return null;if(p(he.charCodeAt(le),te.charCodeAt(ce))){let ae=null,se=ce+1;if(ae=v(he,te,le+1,ce+1,ge),!ge)for(;!ae&&(se=b(te,se))<te.length;)ae=v(he,te,le+1,se,ge),se++;return ae===null?null:c({start:ce,end:ce+1},ae)}else return null}function b(he,te){for(let le=te;le<he.length;le++)if(u(he.charCodeAt(le))||le>0&&u(he.charCodeAt(le-1)))return le;return he.length}const y=L(e.matchesPrefix,h,T),_=L(e.matchesPrefix,h,S),D=new t.LRUCache(1e4);function P(he,te,le=!1){if(typeof he!="string"||typeof te!="string")return null;let ce=D.get(he);ce||(ce=new RegExp(I.convertSimple2RegExpPattern(he),"i"),D.set(he,ce));const ge=ce.exec(te);return ge?[{start:ge.index,end:ge.index+ge[0].length}]:le?_(he,te):y(he,te)}e.matchesFuzzy=P;function A(he,te){const le=Q(he,he.toLowerCase(),0,te,te.toLowerCase(),0,!0);return le?x(le):null}e.matchesFuzzy2=A;function M(he,te,le,ce,ge,ae){const se=Math.min(13,he.length);for(;le<se;le++){const oe=Q(he,te,le,ce,ge,ae,!1);if(oe)return oe}return[0,ae]}e.anyScore=M;function x(he){if(typeof he=="undefined")return[];const te=[],le=he[1];for(let ce=he.length-1;ce>1;ce--){const ge=he[ce]+le,ae=te[te.length-1];ae&&ae.end===ge?ae.end=ge+1:te.push({start:ge,end:ge+1})}return te}e.createMatches=x;const N=128;function k(){const he=[],te=[];for(let le=0;le<=N;le++)te[le]=0;for(let le=0;le<=N;le++)he.push(te.slice(0));return he}function O(he){const te=[];for(let le=0;le<=he;le++)te[le]=0;return te}const F=O(2*N),V=O(2*N),W=k(),z=k(),U=k(),K=!1;function H(he,te,le,ce,ge){function ae(oe,fe,ve=" "){for(;oe.length<fe;)oe=ve+oe;return oe}let se=` |   |${ce.split("").map(oe=>ae(oe,3)).join("|")}
bbros-dev commented 3 years ago

Apart from turning activitusbar.showSourceControlCounter on/off is there anything I can do to trigger more of these .git/index.lock events?

Gruntfuggly commented 3 years ago

When activitusbar.showSourceControlCounter is enabled, it creates file watcher. Any file change event triggers an update (after a delay so multiple events only trigger one update).

Nothing in that log looks like it's associated with the extension, so I honestly don't know why the focus is being affected.

I'm not sure which extension is logging those Event [file] events?

bbros-dev commented 3 years ago

Thanks, I've added some additional data from the affected IDE instance to this comment.

bbros-dev commented 3 years ago

As someone ignorant of the VSCode internals....

it does make sense to me that the counter update interferes with user input - I want to input some text so the IDE displays this next to a file icon, the extension wants to input some text to display next to the git repo icon.

With the flood of file events it appears the extension counter update, likely more than one update is completed in the time it takes the user to provide their input, or is other wises able to circumvent the mechanism used give the user input exclusive access.

Of course that is a high level ignorant interpretation.

Is there another mechanism/api you can use to input/update the counter value?

Anyway, I'm happy to disable the counter to get my input back.

OH, and I should have said at the outset - big thanks for this extension - I won't be uninstalling it any time soon.

Gruntfuggly commented 3 years ago

The extension only updates the status bar items - which shouldn't interfere with any user input. There's no need for any user interaction with the extension at all, it all happens in the background.

I'm really not sure why you're seeing what you're seeing.

Sounds like disabling the counter is the only option.

bbros-dev commented 3 years ago

I have now observed this behavior in another project, and confirm setting activitusbar.showSourceControlCounter to false worksaround the problem.

This project has no Rust in it - so we can eliminate my earlier conjecture the rust analyzer or language server was involved.

One thing both projects have in common is an instance of Hashicorp Vault storing its raft DB in the repository. Each project has its own Vault for bootstrapping secrets. These are serverless, single user/purpose setups of Vault, but they are known to touch/alter the storage artifacts - they show up as changes in the Git status window.

hoodedice commented 3 years ago

I have this issue as well, in multiple projects. Disabling showSourceControlCounter does fix the problem. Please tell me what I can do to help resolve this issue.

tsekka commented 3 years ago

+1 having this issue

In my case, the issue is present specifically if on local Ubuntu(20.04) machine and projects use PHP (tried with laravel, drupal).

On same machine, if projects have no PHP then issue is not present. If on live server (Debian 10, connected via VSCode SSH), then issue is also not present.

Disabling all other extensions didn't help. However, disabling showSourceControlCounter fixes it as stated before.

Gruntfuggly commented 3 years ago

I think I'll disable it by default. I don't understand why it has the effect that it does. If anybody could capture a video showing what happens I'd very much appreciate it.

tsekka commented 3 years ago

There's a screen recording: https://1drv.ms/v/s!ArTqmS9a0VU5q_k6X5Y3msOmGRKCsg?e=q5BDZf

tsekka commented 3 years ago

I don't understand if it could be OS related, but anyway I can easily reproduce the issue on 2 separate ubuntu machines (one having ubuntu 20.04, another 21.04) by simply cloning some php project, eg: git clone https://github.com/laravel/framework.git

Update: I tried but I can´t reproduce the issue on Windows 10.

Gruntfuggly commented 3 years ago

Thanks for the video. It doesn't happen for me on OSX or Ubuntu 18.04. Maybe it's a bug in VSCode, as it makes no sense to me.

If you have time, you could try commenting out line of 436 (setScmCount( total );) of

.vscode/extensions/gruntfugggly.activitusbar.0.0.46/extension.js

That would then isolate if the problem is to do with the file watcher, or updating the button.

I think it's probably the file watcher - I'm guessing there is some event being fired due to the rename.

tsekka commented 3 years ago

Hi, commenting line 436 (setScmCount( total );) did not fix it.

bbros-dev commented 3 years ago

Maybe it's a bug in VSCode, as it makes no sense to me.

It could be a VSCode bug that this extension is triggering. Before I isolated as the extension that triggered this bahavior I do remeber seeing an (old) VSCode issue report around user input losing focus. However that bug was fixed.

Can't recall the bug ... will update if I manage to find it again.

bbros-dev commented 3 years ago

Some issues that may provide a clue:

Gruntfuggly commented 3 years ago

@tsekka thanks for trying that - confirms what I thought.

To be honest, I don't think there is anything I can do to fix this. Now that the counter is disabled by default, it shouldn't affect anybody unexpectedly, so I'm going to close this.

If anybody has any ideas of where to even start trying to find the issue, please feel free to reopen.

bbros-dev commented 3 years ago

@Gruntfuggly: I'd only suggest escalating upstream - its definitely a bug - reproducible and affecting several users. As best you can you've determined its nothing in your code.... so it must be in upstream code?

They will also likely know enough to either own it and fix or point you in the right direction.

This might be prematurely closed because we haven't yet isolated what is the common attribute among us. We can all reproduce it in an affected repository, but not not all repositories we each have seem to trigger the behavior.

@tsekka in those PHP repositories do you have running in the background or foreground some type of dev web-server that refreshes pages on changes? Anything else that might be monitoring or changing files?

In my case the common attribute appears to be a Vault server with its raft files in the repository. git shows me these files have changed content even when I do nothing - likely somthing in the raft protocol.

tsekka commented 3 years ago

@bbros-dev I tried disabling all background processes that I can think of and did not find it and still it persists.

@Gruntfuggly no problem. Personally I don't care much about source control counter in activity bar so disabling it is good enough fix for me...