kburtram / CodeTalk

Rethinking IDE accessibility
https://microsoft.github.io/CodeTalk/
MIT License
1 stars 0 forks source link

Enable Function List for non-C# languages #3

Open kburtram opened 3 years ago

kburtram commented 3 years ago

Currently the Function List implementation for the VSCode extension only supports C# based on the VS extension implementation. Ideally the feature could also work for other languages, possibly reusing metadata available in the VSCode Code Outline feature.

Eternyte commented 3 years ago

Mid-progress report: The code changes I've made are for VS Code's codebase, so nothing to check in for this repository. But current changes I've made so far includes:

  1. Reporting the type of data in the Outline, e.g. "currentValue (number)" instead of just "currentValue". a. This makes the information projected to a developer using screen reader to be the same as a sighted developer.
  2. Reporting the line number in the Outline via aria-label and hover text. a. So NVDA will read "currentValue (number) at line 1" and so forth. Same information if you hover over the element too.

Currently working on:

  1. Hooking up the "show function, methods, and so forth" settings to the Outline settings for better quality of life usage.
  2. Working on a shortcut key to quickly toggle between Show All (aka Code Summary) and Functions/Methods only (aka Function List).
  3. Make reporting the line number a toggleable and optional setting.

But I do have something to demo for this area at the very least, and we can show it with multiple languages.

Screenshot of what it looks like in JavaScript: sample

(This was actually only like two lines of code to implement so far, but it's a new codebase for me so ramping up takes a while. :/ )

Eternyte commented 3 years ago

Completed

  1. Hooking up the "show function, methods, and so forth" settings to the Outline settings for better quality of life usage.

sample2

Eternyte commented 3 years ago

Okay, I kind of have the Function List implementation down: sample3

It's under a shortcut key "Ctrl + Alt + F" when you focus on the Outline pane, such that it'll toggle between show all elements and just the functions and methods and constructors. Since JavaScript may have multiple classes and interfaces in a single file, which isn't a design that's common in C#, I decided to include classes and interfaces in the Function List as well for context.

But also because the way the Outline pane is implemented as a tree, if the class and interfaces aren't included, the children elements won't be included either. And I'm not sure if I should add another feature to allow the tree view to flatten as a list, because I feel like I'm adding more and more features and scope creep.

Ignore all of the errors. I took a random file from VS Code and used it as a test file, so obviously, none of the code works.

Also, I think this screenshot has everything ordered by Name, rather than Position, hence the non-linear ordering of the Outline elements relative to the file. This is a configurable setting for the Outline tree, so don't worry about this.