Skip to content

Commit

Permalink
Work around VS Code specific performance issues (PR #11657)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonarddeR committed Sep 23, 2020
1 parent de18dc1 commit 18c737b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/appModules/code - insiders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2020 NV Access Limited, Leonard de Ruijter
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

""" App module for Visual Studio Code Insiders.
This app module simply inherrits from the app module for the stable version of Code.
"""

# Ignoring Flake8 imported but unused error since appModuleHandler yet uses the import.
from .code import AppModule # noqa: F401
26 changes: 26 additions & 0 deletions source/appModules/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2020 NV Access Limited, Leonard de Ruijter
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

""" App module for Visual Studio Code.
"""

import appModuleHandler
from NVDAObjects.IAccessible.chromium import Document
from NVDAObjects import NVDAObject


class VSCodeDocument(Document):
"""The only content in the root document node of Visual Studio code is the application object.
Creating a tree interceptor on this object causes a major slow down of Code.
Therefore, forcefully block tree interceptor creation.
"""
_get_treeInterceptorClass = NVDAObject._get_treeInterceptorClass


class AppModule(appModuleHandler.AppModule):

def chooseNVDAObjectOverlayClasses(self, obj, clsList):
if Document in clsList and obj.IA2Attributes.get("tag") == "#document":
clsList.insert(0, VSCodeDocument)
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The existence of marked (highlighted) content can be reported in browsers, and t
- The expanded / collapsed state of directories in the navigation treeview on drive.google.com is now always reported by NVDA. (#11520)
- NVDA will auto detect the NLS eReader Humanware braille display via Bluetooth as its Bluetooth name is now "NLS eReader Humanware". (#11561)
- Certain SAPI5 voices (such as Ivona) no longer skip speech. (#10901)
- Major performance improvements in Visual Studio Code. (#11533)


== Changes For Developers ==
Expand Down

0 comments on commit 18c737b

Please sign in to comment.