Skip to content

Add Document symbols aka outline#21

Open
sergioalcaraz wants to merge 22 commits intophil294:masterfrom
sergioalcaraz:feat/document-symbols
Open

Add Document symbols aka outline#21
sergioalcaraz wants to merge 22 commits intophil294:masterfrom
sergioalcaraz:feat/document-symbols

Conversation

@sergioalcaraz
Copy link
Copy Markdown

Initial outline support using the compiler-provided AST.

This presents the tree for variables, functions, classes with their methods, literal objects with their class-like structure, ES6 imports, ES6 exports, and also CommonJS.

sergioalcaraz and others added 22 commits May 4, 2024 23:07
- Expose findDocumentSymbols on LanguageMode
- Implement JS mode mapping from TypeScript navigation tree to DocumentSymbol
- Wire LSP textDocument/documentSymbol handler and capability

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use CoffeeScript.compile(..., { ast: true }) to extract AST and build DocumentSymbol tree
- Fallback to TypeScript navigation + source maps if AST not available or parsing fails

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add coffeeAstService to build DocumentSymbol trees from CoffeeScript AST
- Refactor javascript mode to call service with TypeScript fallback
- Wire service into project/lsp earlier changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add fixture and integration test for Document Symbols (outline)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Produce flat symbol list and build hierarchy by range containment
- Better name extraction (id.name, key.name)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Log collected flat symbol count and root count for debugging

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use console.log to surface counts during tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Only include classes, methods, functions and assignment-based variables in outline
- Clamp selectionRange into range

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Ensure javascript mode uses CoffeeScript AST results and fallbacks
- Silence logger in AST try/catch to avoid missing symbol noise

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…erals; include closures

- Show object literal keys and nested functions
- Include @Property assignments as class properties
- Skip Null/Boolean/Number/String literal nodes to reduce noise
- Synthesize names for anonymous functions (closure(params))

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… is function or object

- When assignment detected, emit symbol for LHS with kind derived from RHS (Function vs Variable)
- Avoid duplicate identifier/function symbols by skipping lhs/rhs nodes where assignment handled them
- Keep traversing RHS so object properties and nested functions are discovered

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tion/name/category

- client: include `outline` in configuration synchronization
- server: read outline.sortOrder (or aliases) from env.getConfig() and sort symbols recursively before returning

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…upport for ES module import specifiers so `import x from 'y'` appears in Document Symbols.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…) in outline\n\nAdd explicit handling for CommonJS assignments so 'module.exports' and 'exports.x' appear with clear names in Document Symbols.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…\n\nAdd export default and named export symbols; refine dotted-name extraction for module.exports/exports.*.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t default' and named exports appear in Document Symbols. Compute range from child nodes when necessary.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s children of export default\n\nWhen export default a anonymous class/function/object, synthesize a name for the inner node so it becomes a child symbol under the 'default' export.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… structure\n\nDo not mark export declarations as seen; let inner class/function/object be collected so their members appear under the export default symbol.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nymous class/function/object\n\nVerify export default anonymous declarations expose inner structure in Document Symbols.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant