Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #107 from dylanbyars/master
Browse files Browse the repository at this point in the history
feat: add objects and arrays in javascript
  • Loading branch information
SmiteshP authored Jun 9, 2022
2 parents cebecec + 16ad161 commit c1e561d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/nvim-gps/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ local configs = {}

local function setup_language_configs()
configs = {
["javascript"] = with_default_config({
icons = {
["array-name"] = '',
["object-name"] = '',
}
}),
["json"] = with_default_config({
icons = {
["array-name"] = '',
Expand Down
36 changes: 36 additions & 0 deletions queries/javascript/nvimGPS.scm
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,39 @@
((field_definition
property: (property_identifier) @method-name
value: (arrow_function)) @scope-root)

; object literal
((variable_declarator
name: (identifier) @object-name
value: (object)) @scope-root)

; object literal modification
((assignment_expression
left: (identifier) @object-name
right: (object)) @scope-root)

; nested objects
((pair
key: (property_identifier) @object-name
value: (_)) @scope-root)

; nested objects with computed_property_name e.g. { [bar] : true }
((pair
key: (computed_property_name) @object-name
value: (_)) @scope-root)

; object property modification
((assignment_expression
left: (member_expression) @object-name
right: (object)) @scope-root)

; array
((variable_declarator
name: (identifier) @array-name
value: (array)) @scope-root)

; array modification
((assignment_expression
left: (identifier) @array-name
right: (array)) @scope-root)

0 comments on commit c1e561d

Please sign in to comment.