Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: component context info #173

Closed
wants to merge 235 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
4a2ba4c
feat: component context info
lifeart Feb 13, 2019
632d8ce
ember-component-info integration
lifeart Feb 13, 2019
90a493d
bump ember-component-info version
lifeart Feb 13, 2019
949d398
ignore engines flag on ci
lifeart Feb 13, 2019
2885529
maybe pod component support
lifeart Feb 13, 2019
6dfbfb4
fixed issues
lifeart Feb 13, 2019
378dd7c
code cleanup
lifeart Feb 14, 2019
5b2b357
type fix
lifeart Feb 14, 2019
7b6f066
code formatting
lifeart Feb 14, 2019
b8dc1c8
let's play with ts support
lifeart Feb 14, 2019
3864ac8
meta-explorer version bump
lifeart Feb 14, 2019
6a2b00f
debugging
lifeart Feb 14, 2019
9552a82
addon component names lookup & uber caching
lifeart Feb 15, 2019
3bc635a
tslint fix
lifeart Feb 15, 2019
a4fe8c9
lockfile update
lifeart Feb 15, 2019
f5cac25
tests fix
lifeart Feb 16, 2019
ac9a784
Merge branch 'master' into component-context-info
lifeart Feb 16, 2019
f42a787
deduplicated deps
lifeart Feb 16, 2019
f0e9430
commented debug
lifeart Feb 16, 2019
0282ef1
deduplicated yarnfile
lifeart Feb 18, 2019
073b41c
attemp to bump version to fix deps including isssue
lifeart Feb 18, 2019
03d4a6f
angle-bracked-components typeahead
lifeart Feb 26, 2019
ccd3397
pods components support
lifeart Feb 26, 2019
271f8c5
go-to-definition for components
lifeart Feb 26, 2019
503e7e1
go-to-definition angle-bracked support
lifeart Feb 26, 2019
1a3c042
improve autocomplete logic for angle-components
lifeart Feb 26, 2019
63ca37c
goto definition for components actions and local paths
lifeart Feb 26, 2019
c0ab5c4
uber go-to definition for actions
lifeart Feb 26, 2019
43780e4
block info
lifeart Feb 26, 2019
d901029
search fix
lifeart Feb 26, 2019
ce22760
better components drill-down
lifeart Feb 26, 2019
5c6ae0f
goto for angle brackets
lifeart Feb 27, 2019
3fd89d2
code cleanup
lifeart Feb 27, 2019
a37245b
maybe pods support
lifeart Feb 27, 2019
d498786
Merge branch 'master' into component-context-info
lifeart Feb 27, 2019
3e24276
snapshot update
lifeart Feb 27, 2019
45da25d
version fix
lifeart Feb 27, 2019
4e265bf
wrong parent fix
lifeart Feb 27, 2019
d70616b
actions parent rebel
lifeart Feb 27, 2019
e3d7d20
basic MU support
lifeart Feb 27, 2019
a1d0e52
action for modifier
lifeart Feb 27, 2019
4e06991
action definition for attribute support
lifeart Feb 27, 2019
a60aa6f
hash pair key usage in templates
lifeart Feb 27, 2019
9eb8aef
code cleanup
lifeart Feb 28, 2019
07ea345
file logger
lifeart Feb 28, 2019
2849591
tslint fixes
lifeart Feb 28, 2019
36a4f15
Merge branch 'master' into component-context-info
lifeart Feb 28, 2019
7d3b7c9
model autocomplete for MU / PODS
lifeart Mar 1, 2019
a9e0f27
list MU route level components stub
lifeart Mar 1, 2019
cdd4a79
definition provider code cleanup
lifeart Mar 1, 2019
67db66b
template definition provider cleanup
lifeart Mar 1, 2019
307a4d6
helping comments
lifeart Mar 1, 2019
7839fe3
transforms search support for pods and mu
lifeart Mar 1, 2019
49e32f1
script definitions code cleanup
lifeart Mar 1, 2019
7329ed6
fixed linting errors
lifeart Mar 1, 2019
037c46c
spacing fix
lifeart Mar 1, 2019
0f82ae6
code cleanup
lifeart Mar 1, 2019
be72f27
tests fix
lifeart Mar 1, 2019
969a821
go meta!
lifeart Mar 1, 2019
406f820
arguments name fix
lifeart Mar 1, 2019
2be134a
more tests
lifeart Mar 1, 2019
aa5c3c2
helper name purify support
lifeart Mar 1, 2019
0cb7f0a
go to route definition for mu / pods / classic
lifeart Mar 1, 2019
f8d6574
component context lookup update
lifeart Mar 1, 2019
c21c9b5
template context provider code cleanup
lifeart Mar 2, 2019
575b419
completion code cleanup
lifeart Mar 2, 2019
56e7b30
angle-bracket helpers
lifeart Mar 2, 2019
037a704
tests cleanup
lifeart Mar 2, 2019
ed60779
redinition descriptor fix
lifeart Mar 2, 2019
727016f
isAddonRoot function to check is current root an ember-addon
lifeart Mar 4, 2019
a1decbb
import path guessing
lifeart Mar 22, 2019
cb331c6
goto service definition from classic component
lifeart Mar 22, 2019
9776920
go-to-definition for addons
lifeart Mar 22, 2019
48dc4f2
scoped addons
lifeart Mar 22, 2019
2192a0c
Merge branch 'master' into component-context-info
lifeart Mar 22, 2019
f64ad77
modifiers provider
lifeart Mar 23, 2019
3249df1
scriptCompletionProvider
lifeart Mar 23, 2019
974d8ed
store lookup
lifeart Mar 23, 2019
deef9a0
model reference completion, including addons routes, models, helpers …
lifeart Mar 23, 2019
1e380e4
shared method for collections lookup
lifeart Mar 23, 2019
003e89b
computed property autocomplete from object scope
lifeart Mar 23, 2019
572ec47
go-to route from 'transitionTo'
lifeart Mar 23, 2019
cdb7b08
transforms completion
lifeart Mar 23, 2019
2a4728a
ast-helpers code cleanup
lifeart Mar 24, 2019
7d15c99
hasNodeType method for ast helpers
lifeart Mar 24, 2019
83e04bd
bugfix: template linting now working again
lifeart Apr 16, 2019
1368141
Merge branch 'master' into component-context-info
lifeart Apr 16, 2019
8d11a51
feat: typescript component context lookup support
lifeart Apr 16, 2019
da5f1fd
lint fixes
lifeart Apr 16, 2019
3a5a793
ignore-engines for vscode-jsonrpc
lifeart Apr 16, 2019
6e31540
feat: basic typescipt files support for completion and definition
lifeart Apr 16, 2019
b1dad89
nested angle bracked components support
lifeart Apr 20, 2019
9b493b7
feat: in-repo-addons-support
lifeart May 16, 2019
20f86b8
feat: in-repo addon lookup for MU
lifeart May 17, 2019
62edb74
feat: component context info
lifeart Feb 13, 2019
3143685
ember-component-info integration
lifeart Feb 13, 2019
5411d5c
bump ember-component-info version
lifeart Feb 13, 2019
8465229
ignore engines flag on ci
lifeart Feb 13, 2019
30313a0
maybe pod component support
lifeart Feb 13, 2019
ea24dc0
fixed issues
lifeart Feb 13, 2019
2e217b6
code cleanup
lifeart Feb 14, 2019
b222fed
type fix
lifeart Feb 14, 2019
2621ef1
code formatting
lifeart Feb 14, 2019
b1af7d1
let's play with ts support
lifeart Feb 14, 2019
d6934e3
meta-explorer version bump
lifeart Feb 14, 2019
592c7f2
debugging
lifeart Feb 14, 2019
f93971c
addon component names lookup & uber caching
lifeart Feb 15, 2019
fc7ce2b
tslint fix
lifeart Feb 15, 2019
ce23dc1
lockfile update
lifeart Feb 15, 2019
68b3de7
tests fix
lifeart Feb 16, 2019
7de40d3
deduplicated deps
lifeart Feb 16, 2019
bbc528b
commented debug
lifeart Feb 16, 2019
f72a0f6
deduplicated yarnfile
lifeart Feb 18, 2019
8ba7e06
attemp to bump version to fix deps including isssue
lifeart Feb 18, 2019
eaa4ab9
angle-bracked-components typeahead
lifeart Feb 26, 2019
4e447fe
pods components support
lifeart Feb 26, 2019
8a2e3ce
go-to-definition for components
lifeart Feb 26, 2019
58ecfb5
go-to-definition angle-bracked support
lifeart Feb 26, 2019
6210a52
improve autocomplete logic for angle-components
lifeart Feb 26, 2019
a80f80b
goto definition for components actions and local paths
lifeart Feb 26, 2019
d879abe
uber go-to definition for actions
lifeart Feb 26, 2019
5df7380
block info
lifeart Feb 26, 2019
97ca156
search fix
lifeart Feb 26, 2019
d2c1915
better components drill-down
lifeart Feb 26, 2019
cb5e9fa
goto for angle brackets
lifeart Feb 27, 2019
a1b15c2
code cleanup
lifeart Feb 27, 2019
2827a5d
maybe pods support
lifeart Feb 27, 2019
d252abc
snapshot update
lifeart Feb 27, 2019
afa3b6b
version fix
lifeart Feb 27, 2019
071ec50
wrong parent fix
lifeart Feb 27, 2019
ea38e9e
actions parent rebel
lifeart Feb 27, 2019
ae0df67
basic MU support
lifeart Feb 27, 2019
2b30df4
action for modifier
lifeart Feb 27, 2019
a37ce96
action definition for attribute support
lifeart Feb 27, 2019
93fcb72
hash pair key usage in templates
lifeart Feb 27, 2019
39b0050
code cleanup
lifeart Feb 28, 2019
52e6623
file logger
lifeart Feb 28, 2019
9dd03ee
tslint fixes
lifeart Feb 28, 2019
28fbb2c
model autocomplete for MU / PODS
lifeart Mar 1, 2019
20b3bc1
list MU route level components stub
lifeart Mar 1, 2019
5cfd2a7
definition provider code cleanup
lifeart Mar 1, 2019
81a0779
template definition provider cleanup
lifeart Mar 1, 2019
252271b
helping comments
lifeart Mar 1, 2019
7f0ff71
transforms search support for pods and mu
lifeart Mar 1, 2019
9a641bb
script definitions code cleanup
lifeart Mar 1, 2019
bacafa5
fixed linting errors
lifeart Mar 1, 2019
29608ce
spacing fix
lifeart Mar 1, 2019
2961192
code cleanup
lifeart Mar 1, 2019
40679d3
tests fix
lifeart Mar 1, 2019
b43e962
go meta!
lifeart Mar 1, 2019
6334d6b
arguments name fix
lifeart Mar 1, 2019
b831340
more tests
lifeart Mar 1, 2019
1b5ded2
helper name purify support
lifeart Mar 1, 2019
6584a5e
go to route definition for mu / pods / classic
lifeart Mar 1, 2019
03d0930
component context lookup update
lifeart Mar 1, 2019
a762346
template context provider code cleanup
lifeart Mar 2, 2019
84f7856
completion code cleanup
lifeart Mar 2, 2019
51e193f
angle-bracket helpers
lifeart Mar 2, 2019
25fb12e
tests cleanup
lifeart Mar 2, 2019
a2914fd
redinition descriptor fix
lifeart Mar 2, 2019
7107765
isAddonRoot function to check is current root an ember-addon
lifeart Mar 4, 2019
1744f96
import path guessing
lifeart Mar 22, 2019
1f43d64
goto service definition from classic component
lifeart Mar 22, 2019
fd7629a
go-to-definition for addons
lifeart Mar 22, 2019
eed5453
scoped addons
lifeart Mar 22, 2019
6618a92
modifiers provider
lifeart Mar 23, 2019
8cebfb9
scriptCompletionProvider
lifeart Mar 23, 2019
9a95cfc
store lookup
lifeart Mar 23, 2019
0c7e1ab
model reference completion, including addons routes, models, helpers …
lifeart Mar 23, 2019
ec996fd
shared method for collections lookup
lifeart Mar 23, 2019
43cc57b
computed property autocomplete from object scope
lifeart Mar 23, 2019
c12eae5
go-to route from 'transitionTo'
lifeart Mar 23, 2019
97f785e
transforms completion
lifeart Mar 23, 2019
2e6fcdb
ast-helpers code cleanup
lifeart Mar 24, 2019
2a9772d
hasNodeType method for ast helpers
lifeart Mar 24, 2019
914e602
bugfix: template linting now working again
lifeart Apr 16, 2019
8a77c08
feat: typescript component context lookup support
lifeart Apr 16, 2019
85b6843
lint fixes
lifeart Apr 16, 2019
69c8151
ignore-engines for vscode-jsonrpc
lifeart Apr 16, 2019
7cb517b
feat: basic typescipt files support for completion and definition
lifeart Apr 16, 2019
22278ec
nested angle bracked components support
lifeart Apr 20, 2019
9eecc69
feat: in-repo-addons-support
lifeart May 16, 2019
4876e5f
feat: in-repo addon lookup for MU
lifeart May 17, 2019
6e6d24c
Merge branch 'component-context-info' of https://github.com/lifeart/e…
lifeart May 17, 2019
3c80418
yarn deduplicate
lifeart May 17, 2019
fa8be9a
feat: peerDependencies lookup support
lifeart May 17, 2019
4278822
feat: we know about v2 addons
lifeart May 17, 2019
b867f1f
feat: component names as components arguments definitionlookup
lifeart May 17, 2019
37af237
meta-explorer bump
lifeart May 24, 2019
7d3cbc3
feat: add template linting to inline templates inside js and ts files
flashios09 Sep 11, 2019
0f182e2
feat: provide completions for inline templates inside js or ts files
flashios09 Sep 11, 2019
9e59854
Merge pull request #1 from flashios09/inline-templates
lifeart Sep 11, 2019
ecd8044
minor improvements
lifeart Sep 11, 2019
46850e4
chore: disable auto-formatting in VS Code.
chriskrycho Sep 20, 2019
347d1e0
fix: remove needless `| null` from `getExtension`.
chriskrycho Sep 20, 2019
a311458
fix(types): remove `any` from `getAllAngleBracketComponents`
chriskrycho Sep 20, 2019
8cc1a0e
fix(performance): remove all uses of memoizee
chriskrycho Sep 20, 2019
6e7e20e
fix(types): include lodash types and fix an `any`.
chriskrycho Sep 20, 2019
b28c769
fix(types): import and use some types from Babel and Glimmer
chriskrycho Sep 20, 2019
076a882
fix(types): remove explicit `any` from script provider
chriskrycho Sep 20, 2019
21a904e
fix(performance,types): improve layout-helpers types and speed
chriskrycho Sep 20, 2019
29b8597
chore(dependencies): bump TypeScript to 3.6
chriskrycho Sep 20, 2019
492834f
chore: remove Module Unification support
chriskrycho Sep 20, 2019
f439042
style: simplify some template completion provider lookups
chriskrycho Sep 20, 2019
ff748f8
chore: fix typo in name of ScriptDefinitionProvider
chriskrycho Sep 20, 2019
4a0c977
fix(types): remove unneeded definite construction operator
chriskrycho Sep 20, 2019
da2018f
style(types): do not use incline constructor declaration in providers
chriskrycho Sep 20, 2019
95b6e54
fix(types,imports): get types by using `import` in definition-helpers
chriskrycho Sep 20, 2019
1f88f76
fix: rework types and implementation of definition-helpers
chriskrycho Sep 20, 2019
5879d87
style: make ast-helpers much briefer and clearer
chriskrycho Sep 20, 2019
0b885e0
fix(types): eliminate `any` from script definition provider
chriskrycho Sep 20, 2019
30b290c
style: extract pure functions in template provider
chriskrycho Sep 20, 2019
f4158aa
style: clarify implementation of `getProjectInRepoAddonsRoots`
chriskrycho Sep 20, 2019
0ce04aa
style: format and implementation of template provider
chriskrycho Sep 20, 2019
0b22682
style: standalone pure functions in script provider
chriskrycho Sep 21, 2019
dace795
docs: explain use of `RESOLVERS` in script provider
chriskrycho Sep 21, 2019
e40e794
:tv: fix windows build support
ezpuzz Sep 28, 2019
23d3efa
Merge pull request #2 from ezpuzz/component-context-info
lifeart Sep 28, 2019
4667086
Merge remote-tracking branch 'origin/master' into fix-build-errors
ezpuzz Oct 1, 2019
6fdee4b
:tv: fix linting errors and travis error
ezpuzz Oct 1, 2019
f079b17
Merge pull request #4 from ezpuzz/fix-build-errors
lifeart Oct 1, 2019
8ad4ff8
:tv: sort package.json with sort-package-json
ezpuzz Oct 1, 2019
c51016f
:tv: jest and ts-jest should always match versions
ezpuzz Oct 1, 2019
5f0bdab
:tv: other dependency updates
ezpuzz Oct 1, 2019
e7aaeaf
:tv: update vscode-uri
ezpuzz Oct 1, 2019
c0494eb
:tv: update glimmer packages
ezpuzz Oct 1, 2019
04fffe2
:tv: vscode-jsonrpc is included by languageserver-protocol
ezpuzz Oct 1, 2019
3ca6eea
:tv: run yarn deduplicate
ezpuzz Oct 1, 2019
2cae69d
:bug: fix integration test type errors
ezpuzz Oct 1, 2019
70fd8f9
:cop: fix test failure
ezpuzz Oct 1, 2019
bc97f88
:cop: fix test fixtures for layout helpers test
ezpuzz Oct 1, 2019
38878f6
Merge pull request #5 from ezpuzz/component-context-info
lifeart Oct 1, 2019
e7e3fe0
0.2.2
lifeart Sep 11, 2019
02c08d9
fix conflicts
lifeart Nov 3, 2019
4381160
fix ci
lifeart Nov 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
out
node_modules
lib/
/lib
!test/**/lib
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: node_js

node_js:
- '7'
- '8'
- '10'

cache: yarn

script:
- yarn compile
- yarn lint
Expand Down
9 changes: 6 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
{
"typescript.tsdk": "./node_modules/typescript/lib",
"[typescript]": {
"editor.formatOnSave": false
}
}
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- yarn install
- yarn install --ignore-engines

# Post-install test scripts.
test_script:
Expand Down
63 changes: 34 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
{
"name": "@emberwatch/ember-language-server",
"description": "A language server implementation for Ember.js projects.",
"version": "0.2.1",
"contributors": [
"Tobias Bieniek <[email protected]>",
"Thomas Sauer <[email protected]>"
],
"license": "MIT",
"description": "A language server implementation for Ember.js projects.",
"repository": {
"type": "git",
"url": "https://github.com/emberwatch/ember-language-server.git"
},
"engines": {
"node": "*"
},
"license": "MIT",
"contributors": [
"Tobias Bieniek <[email protected]>",
"Thomas Sauer <[email protected]>",
"Aleksandr Kanunnikov <[email protected]>"
],
"main": "lib/start-server.js",
"typings": "lib/start-server.d.ts",
"scripts": {
"changelog": "lerna-changelog",
"clean": "rimraf lib/",
"compile": "tsc --skipLibCheck -p .",
"lint": "tslint --project ./tsconfig.json",
"prepublish": "yarn clean && yarn compile",
"test": "jest",
"watch": "tsc --watch -p ."
},
"dependencies": {
"@glimmer/syntax": "^0.39.3",
"@glimmer/syntax": "^0.42.1",
"ast-types": "^0.13.2",
"babylon": "^6.18.0",
"fs-extra": "^5.0.0",
"ember-meta-explorer": "^0.0.11",
"extract-tagged-template-literals": "^1.0.0",
"fs-extra": "^8.1.0",
"fuzzaldrin": "^2.1.0",
"i": "^0.3.5",
"vscode-languageserver": "^4.1.2",
"vscode-uri": "^1.0.6",
"walk-sync": "^1.0.1"
"lodash": "^4.17.11",
"util": "^0.12.1",
"vscode-languageserver": "^5.2.1",
"vscode-uri": "^2.0.3",
"walk-sync": "^2.0.2"
},
"devDependencies": {
"@types/babylon": "^6.16.5",
"@types/babel__core": "^7.1.3",
"@types/estree": "*",
"@types/fuzzaldrin": "^2.1.1",
"@types/jest": "^23.3.13",
"@types/lodash": "^4.14.138",
"@types/node": "^12.7.8",
"jest": "^23.6.0",
"jest": "^22.0.0",
"lerna-changelog": "^0.8.2",
"ts-jest": "^22.4.3",
"rimraf": "^3.0.0",
"ts-jest": "^22.0.0",
"tslint": "^5.20.0",
"typescript": "^2.8.1",
"vscode-jsonrpc": "^3.6.1",
"vscode-languageserver-protocol": "^3.7.1"
"typescript": "^3.6.3",
"vscode-languageserver-protocol": "^3.14.1"
},
"scripts": {
"changelog": "lerna-changelog",
"clean": "rm -rf lib/",
"compile": "tsc -p .",
"lint": "tslint --project ./tsconfig.json",
"prepublish": "yarn clean && yarn compile",
"test": "jest",
"watch": "tsc --watch -p ."
"engines": {
"node": "*"
}
}
140 changes: 140 additions & 0 deletions src/completion-provider/script-completion-provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import {
CompletionItem,
TextDocumentPositionParams
} from 'vscode-languageserver';

import Server from '../server';
import ASTPath from '../glimmer-utils';
import { toPosition } from '../estree-utils';
import { filter } from 'fuzzaldrin';
import { parseScriptFile as parse } from 'ember-meta-explorer';
const { uniqBy } = require('lodash');
import { getExtension } from '../utils/file-extension';
import { log } from '../utils/logger';
import {
isStoreModelLookup,
isRouteLookup,
isModelReference,
isNamedServiceInjection,
isTransformReference,
isComputedPropertyArgument
} from '../utils/ast-helpers';
import {
listRoutes,
listModels,
listServices,
getProjectAddonsInfo,
listTransforms
} from '../utils/layout-helpers';

import { ParseResult} from '@babel/core';

const EXTENSIONS = ['.js', '.ts'];

export default class ScriptCompletionProvider {
constructor(private server: Server) {}
provideCompletions(params: TextDocumentPositionParams): CompletionItem[] {
log('provideCompletions');
if (!EXTENSIONS.includes(getExtension(params.textDocument))) {
return [];
}
const uri = params.textDocument.uri;
const project = this.server.projectRoots.projectForUri(uri);
if (!project) {
return [];
}
const document = this.server.documents.get(uri);
if (!document) {
return [];
}
const { root } = project;
const content = document.getText();

let ast: ParseResult | null = null;
try {
ast = parse(content);
} catch (e) {
return [];
}

const focusPath = ASTPath.toPosition(ast, toPosition(params.position));

if (!focusPath || !project || !document) {
return [];
}

const completions: CompletionItem[] = [];
let textPrefix = '';
try {
if (isStoreModelLookup(focusPath) || isModelReference(focusPath)) {
textPrefix = focusPath.node.value;
listModels(root).forEach(model => {
completions.push(model);
});
getProjectAddonsInfo(root).filter((item: CompletionItem) => {
if (item.detail === 'model') {
completions.push(item);
}
});
} else if (isRouteLookup(focusPath)) {
textPrefix = focusPath.node.value;
listRoutes(root).forEach(model => {
completions.push(model);
});
getProjectAddonsInfo(root).filter((item: CompletionItem) => {
if (item.detail === 'route') {
completions.push(item);
}
});
} else if (isNamedServiceInjection(focusPath)) {
textPrefix = focusPath.node.value;
listServices(root).forEach(model => {
completions.push(model);
});
getProjectAddonsInfo(root).filter((item: CompletionItem) => {
if (item.detail === 'service') {
completions.push(item);
}
});
} else if (isComputedPropertyArgument(focusPath)) {
textPrefix = focusPath.node.value;
if (!focusPath.parentPath || !focusPath.parentPath.parentPath) {
return [];
}
const obj = focusPath.parentPath.parentPath.parent;
(obj.properties || []).forEach((property: any) => {
let name = null;
if (property.key.type === 'StringLiteral') {
name = property.key.value;
} else if (property.key.type === 'Identifier') {
name = property.key.name;
}
if (name !== null) {
completions.push({
kind: 10,
label: name,
detail: 'ObjectProperty'
});
}
});
} else if (isTransformReference(focusPath)) {
textPrefix = focusPath.node.value;
listTransforms(root).forEach((model: any) => {
completions.push(model);
});
getProjectAddonsInfo(root).filter((item: CompletionItem) => {
if (item.detail === 'transform') {
completions.push(item);
}
});
}
} catch (e) {
log('error', e);
}

return filter(uniqBy(completions, 'label'), textPrefix, {
key: 'label',
maxResults: 40
});
}
}
Loading