vscode-code-outline icon indicating copy to clipboard operation
vscode-code-outline copied to clipboard

Outline of Mocha (describe, it) tests

Open namirsab opened this issue 7 years ago • 3 comments

Hey, first of all, thanks for the great plugin!

I'd like to know if there is any way to configure the plugin to show tests outlines

Basically it should show describe and it

describe('my test', () =>{
    it('should do something', () => {
    });
});
* my test
   * should  do something

namirsab avatar Nov 06 '17 15:11 namirsab

You could write a specialized SymbolProvider for mocha test files (assuming you can detect them easily). A SymbolProvider with proper symbol ranges is all it takes for code outline to work.

patrys avatar Nov 06 '17 15:11 patrys

Thanks, could you post a link to a SymbolProvider, so I can take a look?

namirsab avatar Nov 06 '17 15:11 namirsab

The API is here:

  • https://code.visualstudio.com/docs/extensionAPI/vscode-api#_languages
  • https://code.visualstudio.com/docs/extensionAPI/vscode-api#DocumentSymbolProvider

I'm not sure if there's an easy to follow example of providing VSCode language features through an extension. The API is there but the docs are kind of hard to find.

patrys avatar Nov 06 '17 15:11 patrys