Skip to content

Conversation

@jpogran
Copy link
Contributor

@jpogran jpogran commented Oct 3, 2018

This PR implements a DocumentSymbolProvider for the LanguageServer. It parses Puppet manifests and produce symbols for classes, types, parameters and variables.

  • Implement DocumentSymbolProvider
    • Classes
    • Types
    • Parameters
    • Variables
  • Move tests out from puppet_parser_spec and to provider_spec
  • Implement pending tests
  • Fixup commits

@jpogran jpogran force-pushed the GH-56-outlineview branch 14 times, most recently from a0d5ce0 to 4068ce8 Compare October 8, 2018 19:29
@jpogran
Copy link
Contributor Author

jpogran commented Oct 8, 2018

@glennsarti Initial commits squashed, tests fixed. First pass attempt at making rubocop happy. Still todo: determine symbol icons and remove debug list of symbols

@jpogran jpogran self-assigned this Oct 8, 2018
@jpogran jpogran added enhancement New feature or request Language Server labels Oct 11, 2018
@jpogran jpogran added this to the 0.15.0 milestone Oct 11, 2018
@jpogran jpogran force-pushed the GH-56-outlineview branch 7 times, most recently from 51f5e8e to ed00d82 Compare October 12, 2018 15:57
@jpogran
Copy link
Contributor Author

jpogran commented Oct 12, 2018

puppetlabs/puppet-vscode#395 has been merged so this PR can be used by the client now.

@jpogran jpogran changed the title (WIP)(GH-56) OutLineView (GH-56) OutLineView Oct 12, 2018
describe 'PuppetLanguageServer::PuppetParserHelper' do
let(:subject) { PuppetLanguageServer::PuppetParserHelper }
describe 'PuppetLanguageServer::Manifest::DocumentSymbolProvider',
:if => Gem::Version.new(Puppet.version) >= Gem::Version.new('5.0.0') do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens on Puppet 4? Curious why we aren't testing on it?

@glennsarti
Copy link
Contributor

@jpogran I've update your branch with tests for Puppet 4 and some minor fixes.

@jpogran
Copy link
Contributor Author

jpogran commented Oct 15, 2018

Squashed commits and updated changelog

@jpogran
Copy link
Contributor Author

jpogran commented Oct 15, 2018

@glennsarti @michaeltlombardi I think we're good to merge this in today

begin
case documents.document_type(file_uri)
when :manifest
r = PuppetLanguageServer::PuppetParserHelper.extract_document_symbols(content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suprised rubocop didn't complain about the single letter variable.

graph
end

def self.extract_document_symbols(content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here

begin
case documents.document_type(file_uri)
when :manifest
r = PuppetLanguageServer::PuppetParserHelper.extract_document_symbols(content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be using PuppetLanguageServer::Manifest::DocumentSymbolProvider

Copy link
Contributor

@glennsarti glennsarti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending changes.

jpogran and others added 2 commits October 16, 2018 14:36
This commit adds the DocumentSymbolProvider and supporting code to the
LanguageServer. It uses a procedural implementation to parse the output
of the Puppet AST to generate symbols that VSCode understands. This
lights up OutlineView, Breadcrumbs, and symbol search using the
command pallete.
This commit builds on the procedural DocumentSymbolProvider and makes it
a recursive one. This does not support the Puppet 4 AST, and returns an
empty array.
@jpogran
Copy link
Contributor Author

jpogran commented Oct 16, 2018

@glennsarti please review...again

@glennsarti glennsarti merged commit 83e794d into puppetlabs:master Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants