├── AGENTS.md
├── CLAUDE.md
├── internal
├── tree_sitter_grammars
│ └── twig
│ │ ├── build
│ │ ├── node_gyp_bins
│ │ │ └── python3
│ │ ├── binding.Makefile
│ │ └── Release
│ │ │ ├── tree_sitter_twig_binding.node
│ │ │ ├── obj.target
│ │ │ ├── tree_sitter_twig_binding.node
│ │ │ └── tree_sitter_twig_binding
│ │ │ │ ├── src
│ │ │ │ ├── parser.o
│ │ │ │ └── scanner.o
│ │ │ │ └── bindings
│ │ │ │ └── node
│ │ │ │ └── binding.o
│ │ │ └── .deps
│ │ │ └── Release
│ │ │ ├── tree_sitter_twig_binding.node.d
│ │ │ └── obj.target
│ │ │ ├── tree_sitter_twig_binding.node.d
│ │ │ └── tree_sitter_twig_binding
│ │ │ └── src
│ │ │ ├── parser.o.d
│ │ │ └── scanner.o.d
│ │ ├── queries
│ │ ├── highlights.scm
│ │ └── injections.scm
│ │ ├── README.md
│ │ ├── binding.gyp
│ │ ├── bindings
│ │ ├── go
│ │ │ ├── binding.go
│ │ │ └── binding_test.go
│ │ ├── node
│ │ │ ├── index.js
│ │ │ └── binding.cc
│ │ └── rust
│ │ │ ├── build.rs
│ │ │ └── lib.rs
│ │ ├── Cargo.toml
│ │ ├── corpus
│ │ ├── tests.txt
│ │ └── directives.txt
│ │ ├── src
│ │ ├── tree_sitter
│ │ │ └── alloc.h
│ │ └── scanner.c
│ │ └── package.json
├── snippet
│ ├── testdata
│ │ └── nested.json
│ ├── snippet_test.go
│ ├── snippet_indexer.go
│ └── snippet.go
├── indexer
│ ├── indexer.go
│ └── treesitter.go
├── lsp
│ ├── protocol
│ │ ├── error.go
│ │ ├── insert_text_format.go
│ │ ├── references.go
│ │ ├── commands.go
│ │ ├── definition.go
│ │ ├── codelens.go
│ │ ├── hover.go
│ │ ├── diagnostics.go
│ │ ├── codeaction.go
│ │ └── file_sync.go
│ ├── references_types.go
│ ├── definition_types.go
│ ├── diagnostics_provider.go
│ ├── codeaction_types.go
│ ├── references.go
│ ├── definition.go
│ ├── hover.go
│ ├── completion.go
│ ├── codelens.go
│ ├── completion
│ │ ├── feature_completion.go
│ │ ├── route_completion.go
│ │ ├── snippet_completion.go
│ │ ├── theme_completion.go
│ │ └── systemconfig_completion.go
│ ├── codeaction
│ │ ├── twig_codeaction.go
│ │ └── snippet_codeaction.go
│ ├── reference
│ │ └── route_reference.go
│ ├── codelens
│ │ └── php_service_codelens.go
│ ├── diagnostics
│ │ └── snippet_diagnostics.go
│ ├── types.go
│ ├── definition
│ │ ├── route_definition.go
│ │ ├── theme_definition.go
│ │ └── snippet_definition.go
│ └── hover
│ │ └── twig_hover.go
├── symfony
│ ├── testdata
│ │ ├── controller_base.php
│ │ └── controller.php
│ ├── route_usage_indexer.go
│ ├── yaml_routes_test.go
│ ├── route_indexer.go
│ └── php_routes_test.go
├── theme
│ ├── types.go
│ ├── theme_indexer_test.go
│ ├── parser_test.go
│ └── theme_indexer.go
├── tree_sitter_helper
│ ├── debug.go
│ ├── scss.go
│ ├── xml.go
│ ├── text_range.go
│ ├── twig.go
│ └── yaml.go
├── php
│ ├── typeinference.go
│ ├── testdata
│ │ ├── interface.php
│ │ ├── typeinference.php
│ │ ├── 02.php
│ │ ├── inheritance.php
│ │ ├── 05.php
│ │ ├── 03.php
│ │ ├── 01.php
│ │ ├── 04.php
│ │ └── typeinference_inheritance.php
│ ├── ctx.go
│ ├── class.go
│ ├── group_use_test.go
│ ├── treesitter.go
│ ├── interface_test.go
│ ├── inheritance_test.go
│ ├── debug_ast.go
│ └── indexer_advanced_test.go
├── extension
│ ├── types.go
│ ├── testdata
│ │ └── manifest.xml
│ ├── command.go
│ ├── bundle.go
│ └── indexer.go
├── twig
│ ├── testdata
│ │ ├── extension.php
│ │ └── extension2.php
│ ├── path_test.go
│ ├── path.go
│ ├── parser_test.go
│ └── parser.go
├── feature
│ ├── testdata
│ │ └── feature.yaml
│ ├── feature_test.go
│ ├── feature.go
│ └── indexer.go
└── systemconfig
│ └── systemconfig_indexer.go
├── vscode-extension
├── icon.png
├── src
│ └── types.ts
├── .vscode
│ ├── extensions.json
│ ├── launch.json
│ └── tasks.json
├── .vscodeignore
├── tsconfig.json
├── LICENSE
├── esbuild.js
├── README.md
└── package.json
├── .gitignore
├── cmd
└── debug_ast
│ └── main.go
├── LICENSE
├── config.go
├── .windsurfrules
├── go.mod
├── .github
└── workflows
│ ├── release.yml
│ └── tests.yml
├── README.md
├── Makefile
├── .goreleaser.yaml
└── LSP.md
/AGENTS.md:
--------------------------------------------------------------------------------
1 | .windsurfrules
--------------------------------------------------------------------------------
/CLAUDE.md:
--------------------------------------------------------------------------------
1 | .windsurfrules
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/node_gyp_bins/python3:
--------------------------------------------------------------------------------
1 | /usr/bin/python3
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/queries/highlights.scm:
--------------------------------------------------------------------------------
1 | (comment) @comment
2 |
--------------------------------------------------------------------------------
/vscode-extension/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shopwareLabs/shopware-lsp/HEAD/vscode-extension/icon.png
--------------------------------------------------------------------------------
/vscode-extension/src/types.ts:
--------------------------------------------------------------------------------
1 | type SnippetFile = {
2 | name: string;
3 | path: string;
4 | value: string;
5 | };
--------------------------------------------------------------------------------
/vscode-extension/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["connor4312.esbuild-problem-matchers"]
3 | }
4 |
--------------------------------------------------------------------------------
/vscode-extension/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | node_modules
3 | out/
4 | src/
5 | tsconfig.json
6 | webpack.config.js
7 | esbuild.js
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/README.md:
--------------------------------------------------------------------------------
1 | # tree-sitter-twig
2 |
3 | Twig grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
4 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/queries/injections.scm:
--------------------------------------------------------------------------------
1 | ((content) @injection.content
2 | (#set! injection.language "html")
3 | (#set! injection.combined))
4 |
--------------------------------------------------------------------------------
/internal/snippet/testdata/nested.json:
--------------------------------------------------------------------------------
1 | {
2 | "foo": {
3 | "name": "title",
4 | "foo": {
5 | "name": "title"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/binding.Makefile:
--------------------------------------------------------------------------------
1 | # This file is generated by gyp; do not edit.
2 |
3 | export builddir_name ?= ./build/.
4 | .PHONY: all
5 | all:
6 | $(MAKE) tree_sitter_twig_binding
7 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/Release/tree_sitter_twig_binding.node:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shopwareLabs/shopware-lsp/HEAD/internal/tree_sitter_grammars/twig/build/Release/tree_sitter_twig_binding.node
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /shopware-lsp
2 | node_modules
3 | /vscode-extension/out
4 | /vscode-extension/dist
5 | /dist
6 | /.opencode
7 | internal/php/alias_resolver.go
8 | internal/php/php.db
9 | **/.claude/settings.local.json
10 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding.node:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shopwareLabs/shopware-lsp/HEAD/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding.node
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding/src/parser.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shopwareLabs/shopware-lsp/HEAD/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding/src/parser.o
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding/src/scanner.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shopwareLabs/shopware-lsp/HEAD/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding/src/scanner.o
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding/bindings/node/binding.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shopwareLabs/shopware-lsp/HEAD/internal/tree_sitter_grammars/twig/build/Release/obj.target/tree_sitter_twig_binding/bindings/node/binding.o
--------------------------------------------------------------------------------
/vscode-extension/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "es2020",
5 | "outDir": "out",
6 | "lib": ["es2020"],
7 | "sourceMap": true,
8 | "rootDir": "src",
9 | "strict": true
10 | },
11 | "exclude": ["node_modules", ".vscode-test"]
12 | }
13 |
--------------------------------------------------------------------------------
/internal/indexer/indexer.go:
--------------------------------------------------------------------------------
1 | package indexer
2 |
3 | import tree_sitter "github.com/tree-sitter/go-tree-sitter"
4 |
5 | type Indexer interface {
6 | ID() string
7 | Index(path string, node *tree_sitter.Node, fileContent []byte) error
8 | RemovedFiles(paths []string) error
9 | Close() error
10 | Clear() error
11 | }
12 |
--------------------------------------------------------------------------------
/internal/lsp/protocol/error.go:
--------------------------------------------------------------------------------
1 | package protocol
2 |
3 | type ShopwareLspError struct {
4 | Code string `json:"code"`
5 | Message string `json:"message"`
6 | }
7 |
8 | func NewLspError(message string, code string) *ShopwareLspError {
9 | return &ShopwareLspError{
10 | Code: code,
11 | Message: message,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/build/Release/.deps/Release/tree_sitter_twig_binding.node.d:
--------------------------------------------------------------------------------
1 | cmd_Release/tree_sitter_twig_binding.node := ln -f "Release/obj.target/tree_sitter_twig_binding.node" "Release/tree_sitter_twig_binding.node" 2>/dev/null || (rm -rf "Release/tree_sitter_twig_binding.node" && cp -af "Release/obj.target/tree_sitter_twig_binding.node" "Release/tree_sitter_twig_binding.node")
2 |
--------------------------------------------------------------------------------
/internal/symfony/testdata/controller_base.php:
--------------------------------------------------------------------------------
1 | ")
13 | os.Exit(1)
14 | }
15 |
16 | filePath := os.Args[1]
17 | fmt.Printf("Analyzing AST for file: %s\n\n", filePath)
18 |
19 | php.DebugAST(filePath)
20 | }
21 |
--------------------------------------------------------------------------------
/internal/lsp/protocol/insert_text_format.go:
--------------------------------------------------------------------------------
1 | package protocol
2 |
3 | // InsertTextFormat defines how inserted text should be interpreted
4 | type InsertTextFormat int
5 |
6 | const (
7 | // PlainTextFormat indicates the inserted text is interpreted as plain text
8 | PlainTextFormat InsertTextFormat = 1
9 | // SnippetTextFormat indicates the inserted text is interpreted as a snippet
10 | SnippetTextFormat InsertTextFormat = 2
11 | )
12 |
--------------------------------------------------------------------------------
/internal/theme/types.go:
--------------------------------------------------------------------------------
1 | package theme
2 |
3 | // ThemeConfigField represents a field in the theme configuration
4 | type ThemeConfigField struct {
5 | Key string
6 | Label map[string]string
7 | Type string
8 | Value string
9 | Editable bool
10 | Block string
11 | Order int
12 | Path string // Path to the theme.json file
13 | Line int // Line number where the field is defined
14 | Scss bool
15 | }
16 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/binding.gyp:
--------------------------------------------------------------------------------
1 | {
2 | "targets": [
3 | {
4 | "target_name": "tree_sitter_twig_binding",
5 | "include_dirs": [
6 | "
5 | // #include "tree_sitter/parser.h"
6 | //
7 | // #define TREE_SITTER_LANGUAGE_VERSION 14
8 | //
9 | // #include "../../src/parser.c"
10 | // #include "../../src/scanner.c"
11 | import "C"
12 | import "unsafe"
13 |
14 | // Language returns the tree-sitter language for Twig.
15 | func Language() unsafe.Pointer {
16 | return unsafe.Pointer(C.tree_sitter_twig())
17 | }
18 |
--------------------------------------------------------------------------------
/vscode-extension/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": "Run Extension",
6 | "type": "extensionHost",
7 | "request": "launch",
8 | "args": [
9 | "--extensionDevelopmentPath=${workspaceFolder}"
10 | ],
11 | "outFiles": [
12 | "${workspaceFolder}/out/**/*.js"
13 | ],
14 | "preLaunchTask": "${defaultBuildTask}",
15 | "env": {
16 | "VSCODE_DEBUG_MODE": "true"
17 | }
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/internal/lsp/diagnostics_provider.go:
--------------------------------------------------------------------------------
1 | package lsp
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/shopware/shopware-lsp/internal/lsp/protocol"
7 | tree_sitter "github.com/tree-sitter/go-tree-sitter"
8 | )
9 |
10 | // DiagnosticsProvider is an interface for providing diagnostics for a document
11 | type DiagnosticsProvider interface {
12 | // GetDiagnostics returns diagnostics for a document
13 | GetDiagnostics(ctx context.Context, uri string, rootNode *tree_sitter.Node, content []byte) ([]protocol.Diagnostic, error)
14 | }
15 |
--------------------------------------------------------------------------------
/internal/php/typeinference.go:
--------------------------------------------------------------------------------
1 | // Package php provides PHP language support for the LSP
2 | package php
3 |
4 | // typeinference.go
5 | // This file is a placeholder for type inference functionality.
6 | // The actual implementation for PHP type inference is in indexer.go
7 | // where the handleMemberCallExpression method now supports:
8 | // 1. Type inference for $this->method() calls
9 | // 2. Full class hierarchy traversal (parent classes and interfaces)
10 | // 3. Method return type resolution through multiple inheritance levels
11 |
--------------------------------------------------------------------------------
/internal/symfony/testdata/controller.php:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | Fooo
6 |
7 | A description
8 | Your Company Ltd.
9 | (c) by Your Company Ltd.
10 | 1.0.0
11 |
12 | MIT
13 |
14 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "tree-sitter-twig"
3 | description = "twig grammar for the tree-sitter parsing library"
4 | version = "0.0.1"
5 | keywords = ["incremental", "parsing", "twig"]
6 | categories = ["parsing", "text-editors"]
7 | repository = "https://github.com/tree-sitter/tree-sitter-twig"
8 | edition = "2018"
9 | license = "MIT"
10 |
11 | build = "bindings/rust/build.rs"
12 | include = [
13 | "bindings/rust/*",
14 | "grammar.js",
15 | "queries/*",
16 | "src/*",
17 | ]
18 |
19 | [lib]
20 | path = "bindings/rust/lib.rs"
21 |
22 | [dependencies]
23 | tree-sitter = "~0.20.10"
24 |
25 | [build-dependencies]
26 | cc = "1.0"
27 |
--------------------------------------------------------------------------------
/internal/php/testdata/typeinference.php:
--------------------------------------------------------------------------------
1 | id;
13 | }
14 |
15 | public function getName(): string
16 | {
17 | return $this->name;
18 | }
19 |
20 | public function setName(string $name): self
21 | {
22 | $this->name = $name;
23 | return $this;
24 | }
25 |
26 | public function getNameWithPrefix(string $prefix): string
27 | {
28 | return $prefix . $this->getName();
29 | }
30 |
31 | public function getSelf(): self
32 | {
33 | return $this;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/internal/lsp/protocol/references.go:
--------------------------------------------------------------------------------
1 | package protocol
2 |
3 | import tree_sitter "github.com/tree-sitter/go-tree-sitter"
4 |
5 | // ReferenceParams represents the parameters for a references request
6 | type ReferenceParams struct {
7 | TextDocument struct {
8 | URI string `json:"uri"`
9 | } `json:"textDocument"`
10 | Position struct {
11 | Line int `json:"line"`
12 | Character int `json:"character"`
13 | } `json:"position"`
14 | Context struct {
15 | IncludeDeclaration bool `json:"includeDeclaration"`
16 | } `json:"context"`
17 | // Custom fields for internal use (not part of LSP spec)
18 | // These fields are used to pass document content to reference providers
19 | DocumentContent []byte `json:"-"`
20 | Node *tree_sitter.Node `json:"-"`
21 | }
22 |
--------------------------------------------------------------------------------
/internal/twig/testdata/extension.php:
--------------------------------------------------------------------------------
1 | test(...)),
16 | ];
17 | }
18 |
19 | public function getFilters(): array
20 | {
21 | return [
22 | new TwigFilter('abs', 'abs'),
23 | new TwigFilter('test', [$this, 'test']),
24 | new TwigFilter('test2', $this->test(...)),
25 | ];
26 | }
27 |
28 | public function test(string $test)
29 | {
30 | return 'test';
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/internal/lsp/references.go:
--------------------------------------------------------------------------------
1 | package lsp
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/shopware/shopware-lsp/internal/lsp/protocol"
7 | )
8 |
9 | // references handles textDocument/references requests
10 | func (s *Server) references(ctx context.Context, params *protocol.ReferenceParams) []protocol.Location {
11 | node, docText, ok := s.documentManager.GetNodeAtPosition(params.TextDocument.URI, params.Position.Line, params.Position.Character)
12 | if ok {
13 | params.Node = node
14 | params.DocumentContent = docText.Text
15 | }
16 |
17 | // Collect reference locations from all providers
18 | var locations []protocol.Location
19 | for _, provider := range s.referencesProviders {
20 | providerLocations := provider.GetReferences(ctx, params)
21 | locations = append(locations, providerLocations...)
22 | }
23 |
24 | return locations
25 | }
26 |
--------------------------------------------------------------------------------
/internal/php/testdata/02.php:
--------------------------------------------------------------------------------
1 | request = new Request();
20 | }
21 |
22 | public function load(string $id): array
23 | {
24 | return ['id' => $id];
25 | }
26 |
27 | protected function validateId(string $id): bool
28 | {
29 | return strlen($id) > 0;
30 | }
31 |
32 | private function getRepository(): string
33 | {
34 | return $this->productRepository;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/corpus/tests.txt:
--------------------------------------------------------------------------------
1 | ==================
2 | Divisible by
3 | ==================
4 | {% if loop.index is divisible by(3) %}
5 | ...
6 | {% endif %}
7 | ---
8 | (template
9 | (if
10 | (binary_expression
11 | (member_expression
12 | (variable)
13 | (property))
14 | (call_expression
15 | (function)
16 | (arguments
17 | (number))))
18 | (source_elements
19 | (content))))
20 |
21 | ==================
22 | Same as
23 | ==================
24 | {% if foo.attribute is same as(false) %}
25 | ...
26 | {% endif %}
27 | ---
28 | (template
29 | (if
30 | (binary_expression
31 | (member_expression
32 | (variable)
33 | (property))
34 | (call_expression
35 | (function)
36 | (arguments
37 | (boolean))))
38 | (source_elements
39 | (content))))
40 |
--------------------------------------------------------------------------------
/internal/php/testdata/inheritance.php:
--------------------------------------------------------------------------------
1 | id;
25 | }
26 |
27 | public function getName(): string
28 | {
29 | return $this->name;
30 | }
31 |
32 | public function setName(string $name): self
33 | {
34 | $this->name = $name;
35 | return $this;
36 | }
37 |
38 | // Implementation of Countable interface
39 | public function count(): int
40 | {
41 | return 1;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/bindings/go/binding_test.go:
--------------------------------------------------------------------------------
1 | package twig
2 |
3 | import (
4 | "testing"
5 | "unsafe"
6 |
7 | treesitter "github.com/tree-sitter/go-tree-sitter"
8 | )
9 |
10 | func TestLanguage(t *testing.T) {
11 | lang := Language()
12 | if lang == nil {
13 | t.Error("Expected language binding to return a valid pointer")
14 | }
15 | if lang == unsafe.Pointer(nil) {
16 | t.Error("Expected language binding to return a non-nil unsafe pointer")
17 | }
18 | }
19 |
20 | func TestParseTwig(t *testing.T) {
21 | parser := treesitter.NewParser()
22 | if err := parser.SetLanguage(treesitter.NewLanguage(Language())); err != nil {
23 | t.Fatalf("Failed to set language: %v", err)
24 | }
25 |
26 | source := []byte(`{% extends "base.html" %}`)
27 | tree := parser.Parse(source, nil)
28 |
29 | root := tree.RootNode()
30 | if root.Kind() != "template" {
31 | t.Errorf("Expected root node to be 'template', got %s", root.Kind())
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/internal/twig/path_test.go:
--------------------------------------------------------------------------------
1 | package twig
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/stretchr/testify/assert"
7 | )
8 |
9 | func TestConvertToRelativePath(t *testing.T) {
10 | assert.Equal(t, "", ConvertToRelativePath(""))
11 | assert.Equal(t, "", ConvertToRelativePath("/"))
12 | assert.Equal(t, "", ConvertToRelativePath("/Resources/views"))
13 | assert.Equal(t, "", ConvertToRelativePath("/Resources/views/"))
14 | assert.Equal(t, "@Storefront/storefront/base.html.twig", ConvertToRelativePath("/Resources/views/storefront/base.html.twig"))
15 | }
16 |
17 | func TestGetBundleNameByPath(t *testing.T) {
18 | assert.Equal(t, "foo", getBundleNameByPath("foo/Resources/views/storefront/base.html.twig"))
19 | assert.Equal(t, "storefront", getBundleNameByPath("vendor/shopware/storefront/Resources/views/storefront/base.html.twig"))
20 | assert.Equal(t, "MyFoo", getBundleNameByPath("vendor/store.shopware.com/MyFoo/src/Resources/views/storefront/base.html.twig"))
21 | }
22 |
--------------------------------------------------------------------------------
/internal/extension/command.go:
--------------------------------------------------------------------------------
1 | package extension
2 |
3 | import (
4 | "context"
5 | "encoding/json"
6 |
7 | "github.com/shopware/shopware-lsp/internal/lsp"
8 | )
9 |
10 | type ExtensionCommandProvider struct {
11 | extensionIndex *ExtensionIndexer
12 | }
13 |
14 | func NewExtensionCommandProvider(lsp *lsp.Server) *ExtensionCommandProvider {
15 | extensionIndex, _ := lsp.GetIndexer("extension.indexer")
16 |
17 | return &ExtensionCommandProvider{
18 | extensionIndex: extensionIndex.(*ExtensionIndexer),
19 | }
20 | }
21 | func (e *ExtensionCommandProvider) GetCommands(ctx context.Context) map[string]lsp.CommandFunc {
22 | return map[string]lsp.CommandFunc{
23 | "shopware/extension/all": e.allExtensions,
24 | }
25 | }
26 |
27 | func (e *ExtensionCommandProvider) allExtensions(ctx context.Context, args *json.RawMessage) (interface{}, error) {
28 | extensions, err := e.extensionIndex.GetAll()
29 | if err != nil {
30 | return nil, err
31 | }
32 |
33 | return extensions, nil
34 | }
35 |
--------------------------------------------------------------------------------
/vscode-extension/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "watch",
6 | "dependsOn": ["npm: watch:tsc", "npm: watch:esbuild"],
7 | "presentation": {
8 | "reveal": "never"
9 | },
10 | "group": {
11 | "kind": "build",
12 | "isDefault": true
13 | }
14 | },
15 | {
16 | "type": "npm",
17 | "script": "watch:esbuild",
18 | "group": "build",
19 | "problemMatcher": "$esbuild-watch",
20 | "isBackground": true,
21 | "label": "npm: watch:esbuild",
22 | "presentation": {
23 | "group": "watch",
24 | "reveal": "never"
25 | }
26 | },
27 | {
28 | "type": "npm",
29 | "script": "watch:tsc",
30 | "group": "build",
31 | "problemMatcher": "$tsc-watch",
32 | "isBackground": true,
33 | "label": "npm: watch:tsc",
34 | "presentation": {
35 | "group": "watch",
36 | "reveal": "never"
37 | }
38 | }
39 | ]
40 | }
--------------------------------------------------------------------------------
/internal/tree_sitter_grammars/twig/bindings/node/binding.cc:
--------------------------------------------------------------------------------
1 | #include "tree_sitter/parser.h"
2 | #include
3 | #include "nan.h"
4 |
5 | using namespace v8;
6 |
7 | extern "C" TSLanguage * tree_sitter_twig();
8 |
9 | namespace {
10 |
11 | NAN_METHOD(New) {}
12 |
13 | void Init(Local