PDA

View Full Version : Doesn't work - can't auto-complete Ext.Ajax.request



IvanJ
14 Nov 2016, 6:19 PM
Tried using it with our app which is pretty standard Sencha generated app, having Ext source folder a level up.

Edited the plugin config and pointed "includes" at that folder. Still cannot auto-complete "Ext.Ajax.request" or "go to definition" on one of my classes.

No errors visible. Any advice?

Mark.Brocato
15 Nov 2016, 9:06 AM
Can you post your plugin config? Also, what OS are you using?

IvanJ
15 Nov 2016, 9:11 AM
Can you post your plugin config? Also, what OS are you using?

Windows 10 Pro


{ // List directories outside of the project root which should be included when indexing. Paths may be relative
// to the project root or absolute.
"include": [
"../jslib/extjs5/src"
],
...

IvanJ
15 Nov 2016, 9:12 AM
I also tried including just ../jslib/extjs5 , but that didn't work either. There was some "indexing" time though so it seemed like it was doing something.

Mark.Brocato
15 Nov 2016, 9:13 AM
On windows you need to use "" instead of "/" to delimit paths. Since it's in JSON, you'll need to escape those as "\". So it should be:

"include": ["..\\jslib\\extjs5\\src"],

Mark.Brocato
15 Nov 2016, 9:17 AM
Also, does your app have an app.json (which would normally be created by Sencha Cmd)? The plugin uses app.json to understand the app root namespace, and sdk version. If you don't have an app.json, you should add an entry to the "apps" config at the bottom of the plugin configuration file. For example:



"apps": [
{
"name": "AppRootNamespace",
"path": "path\\to\\app",
"toolkit": "classic",
"sdk": {
"path": "..\\jslib\\extjs5\\src",
"version": "5.0.0",
"framework": "extjs"
}
}
]

IvanJ
15 Nov 2016, 10:02 AM
Thanks for the response!

We do have a standard app.json. I did try using your recommendation regarding the "include" array format, but it didn't seem to help.

Is there any way to troubleshoot this? The editor seems better than Sublime, and if this actually worked it would be amazing!

Again, thank you!

Mark.Brocato
15 Nov 2016, 10:05 AM
You can access the log file via the "Show Ext JS Plugin Log File" command in the cmd palette (ctrl+shift+P). Can you post the contents?

IvanJ
15 Nov 2016, 10:10 AM
2016-11-15T18:09:04.873Z - info: tern executable path : C:\Users\Ivan Jouikov\.vscode\extensions\Sencha.vscode-extjs-1.0.0\tern\win32\tern-win32
2016-11-15T18:09:05.000Z - info: tern executable permission granted
2016-11-15T18:09:10.942Z - info: [tern output] - environment: unknown (tern v233)


2016-11-15T18:09:12.150Z - info: [tern output] - found config.json at \\is70\intellisurvey\versions\7.0\isbase\html\admin\.sencha\ide\config.json
contents:
{
"include": [
"..\\jslib\\extjs5\\src"
]
}
include [ '\\\\is70\\intellisurvey\\versions\\7.0\\isbase\\html\\admin',
'\\\\is70\\intellisurvey\\versions\\7.0\\isbase\\html\\jslib\\extjs5\\src' ]
contents after postprocessing:
{
"include": [
"\\\\is70\\intellisurvey\\versions\\7.0\\isbase\\html\\admin",
"\\\\is70\\intellisurvey\\versions\\7.0\\isbase\\html\\jslib\\extjs5\\src"
],
"apps": [],
"exclude": []
}
Found apps: [
{
"path": "\\\\is70\\intellisurvey\\versions\\7.0\\isbase\\html\\admin",
"sdk": {},
"name": "Isvy"
}
]
loading 0 js files in project...
project loaded in 0 seconds
wrote indexes
Listening on port 61572


2016-11-15T18:09:12.165Z - info: tern running at : http://localhost:61572

Mark.Brocato
15 Nov 2016, 10:18 AM
Yep, it looks like it's not finding any files. All of the paths should start with something like "C:\" but yours start with "\\\". Any chance you're using a network drive?

IvanJ
15 Nov 2016, 10:20 AM
Yes I am... all code is hosted on local VM which I'm accessing through Samba. I intend to change that, but should that really affect the operation of this plugin?

Thanks!

IvanJ
15 Nov 2016, 10:35 AM
So I copied all the files out of network drive. Upon opening that folder, a rather lengthy (40 seconds maybe) "Indexing ExtJS" appeared on the bottom. Then intellisense didn't work period. Upon examining the ExtJS log as per your previous instructions, I saw the following:

2016-11-15T18:31:54.042Z - info: tern executable path : C:\Users\Ivan Jouikov\.vscode\extensions\Sencha.vscode-extjs-1.0.0\tern\win32\tern-win32
2016-11-15T18:31:54.138Z - info: tern executable permission granted
2016-11-15T18:31:58.123Z - info: [tern output] - environment: unknown (tern v233)


Any idea?

Thanks!

IvanJ
15 Nov 2016, 10:36 AM
Now if I do Ctrl+P it just shows 'Loading' with spinner and nothing happens.

Mark.Brocato
15 Nov 2016, 12:12 PM
Did it ever finish indexing? You can tell by looking at .sencha/temp/.ide/status.json. You should see:


{"pctComplete":100}

IvanJ
15 Nov 2016, 1:18 PM
Shows 100

Mark.Brocato
15 Nov 2016, 1:23 PM
Hmm... kinda stumped then... Is there anything else in the logs or does it just end with: 2016-11-15T18:31:58.123Z - info: [tern output] - environment: unknown (tern v233)?

One thing I've run into before is problems with indexing bootstrap.js (created by cmd). If you have that file you could try adding it to your exclude paths. The plugin should automatically skip it but maybe it's not for some reason?

IvanJ
15 Nov 2016, 1:27 PM
Nothing else in that log...

I changed config.json to have

"exclude": [
"bootstrap.js"
]

...I didn't see any sort of re-indexing afterwards, even after reloading the VSC, but didn't seem to help at all.

Mark.Brocato
15 Nov 2016, 1:29 PM
Is there anything in the log after restarting?

IvanJ
15 Nov 2016, 1:30 PM
No same thing

Mark.Brocato
15 Nov 2016, 1:32 PM
The plugin uses a node server called tern.js to provide code completions. I'm guessing that server must be dying at startup for some reason. Do you see any processes called tern.exe running?

IvanJ
15 Nov 2016, 1:40 PM
I do not see such process in Task Manager Processes list

Mark.Brocato
15 Nov 2016, 1:56 PM
Can you try running tern directly from a command prompt? Let's see if it starts up fine or if there are any errors. Please post the console output that you see from:



"C:\Users\Ivan Jouikov\.vscode\extensions\Sencha.vscode-extjs-1.0.0\tern\win32\tern-win32.exe" --dir=c:\path\to\project

Mark.Brocato
15 Nov 2016, 1:59 PM
Also, I just noticed that the log file won't refresh in the editor when new content is written to it. You have to close the file and reopen it using the "Show Ext JS Plugin Log File" command to see updates. Maybe that's why it didn't look like anything new was logged?

IvanJ
15 Nov 2016, 5:19 PM
I did pull up that log file every time from the menu...

Running that command you suggested, using "Administrator" mode on CMD:

C:\WINDOWS\system32>"C:\Users\Ivan Jouikov\.vscode\extensions\Sencha.vscode-extjs-1.0.0\tern\win32\tern-win32.exe" --dir="c:\Users\Ivan Jouikov\Desktop\html\admin"
environment: unknown (tern v233)
found config.json at C:\WINDOWS\system32\.sencha\ide\config.json
contents:
{}
include [ 'C:\\WINDOWS\\system32' ]
contents after postprocessing:
{
"include": [
"C:\\WINDOWS\\system32"
],
"apps": [],
"exclude": []
}
Found apps: []
loading 8 js files in project...
project loaded in 6.221 seconds
wrote indexes
Listening on port 51976

IvanJ
15 Nov 2016, 5:21 PM
...or if running from my project folder (and still passing flag), rather than system32:


c:\Users\Ivan Jouikov\Desktop\html\admin>"C:\Users\Ivan Jouikov\.vscode\extensions\Sencha.vscode-extjs-1.0.0\tern\win32\tern-win32.exe" --dir="c:\Users\Ivan Jouikov\Desktop\html\admin"environment: unknown (tern v233)
found config.json at c:\Users\Ivan Jouikov\Desktop\html\admin\.sencha\ide\config.json
contents:
{
"include": [
"..\\jslib\\extjs5\\src"
],
"exclude": [
"bootstrap.js"
]
}
include [ 'C:\\Users\\Ivan Jouikov\\Desktop\\html\\admin',
'C:\\Users\\Ivan Jouikov\\Desktop\\html\\jslib\\extjs5\\src' ]
contents after postprocessing:
{
"include": [
"C:\\Users\\Ivan Jouikov\\Desktop\\html\\admin",
"C:\\Users\\Ivan Jouikov\\Desktop\\html\\jslib\\extjs5\\src"
],
"exclude": [
"C:\\Users\\Ivan Jouikov\\Desktop\\html\\admin\\bootstrap.js"
],
"apps": []
}
Found apps: [
{
"path": "C:\\Users\\Ivan Jouikov\\Desktop\\html\\admin",
"sdk": {},
"name": "Isvy"
}
]
loading 1354 js files in project...
project loaded in 3.302 seconds
wrote indexes
wrote indexes


node.js:813
throw ee;
^
Error: EPERM, operation not permitted 'C:\Users\Ivan Jouikov\Desktop\html\admin\.sencha\temp\.ide\.tern-port'
at Object.fs.openSync (fs.js:449:16)
at Object.fs.writeFileSync (fs.js:1076:11)
at Server.msg (C:\Users\Ivan Jouikov\.vscode\extensions\Sencha.vscode-extjs-1.0.0\tern\win32\bin\tern.js.jx:252:8)
at Server.g (events.js:160:10)
at Server.emit (events.js:79:9)
at net.js:987:6
at process._tickCallback (node.js:803:1)
at Function.Module.runMain (module.js:819:9)
at startup (node.js:374:8)
at node.js:1461:1

Mark.Brocato
16 Nov 2016, 5:34 AM
Looks like tern doesn't have write permissions to create the port file. Can you post a screenshot of the security tab when you right-click and select properties on tern-win32.exe?

Mark.Brocato
16 Nov 2016, 7:26 AM
It looks like others are running into a similar issue. I've got a build that might fix it. If you want to try it PM me your email and I'll send it to you.

SebTardif
14 Dec 2016, 5:18 AM
[QUOTE=IvanJ;1165041]Still cannot auto-complete "Ext.Ajax.request"/QUOTE]

Did you ever get that working?

Mark.Brocato
14 Dec 2016, 7:12 AM
Ivan and I got it working over hangouts. It was a matter of getting the correct path to the sdk in the apps section of the plugin configuration.

SebTardif
14 Dec 2016, 7:31 AM
Ivan and I got it working over hangouts. It was a matter of getting the correct path to the sdk in the apps section of the plugin configuration.
My understanding is that if Ivan was using Sencha Cmd any modification to default empty plugin configuration should not be needed, right?

Mark.Brocato
14 Dec 2016, 7:37 AM
If you use cmd to create your app/workspace, and don't alter the default structure, you shouldn't need to change the plugin configuration. In his particular case, the Ext JS framework was outside of his project (typically it's in the ext directory at the workspace root), so we needed to add an app entry to tell the extension where to find it. If you're having similar issues, I'd be happy to do a hangout with you to help sort things out.

SebTardif
14 Dec 2016, 7:51 AM
If you use cmd to create your app/workspace, and don't alter the default structure, you shouldn't need to change the plugin configuration. In his particular case, the Ext JS framework was outside of his project (typically it's in the ext directory at the workspace root), so we needed to add an app entry to tell the extension where to find it.
I thought from other thread, the plug-in didn't hardcoded the location but instead was able to retrieve it from the Sencha Project workspace like from file workspace.json:


"frameworks": {
"ext": "ext-6.2.0.981"
},


My workspace and my ext folder named 'ext-6.2.0.981' are one level higher than my app.

So really it's not "If you use Sencha Cmd project, and are able to build with Sencha cmd, things will just work" but instead "if you use one specific default layout when building your app with sencha cmd, and never modify anything, it will work".

Mark.Brocato
14 Dec 2016, 8:03 AM
The changes you describe should work. As long as you have the following...

app.json:


"framework": "ext"

workspace.json:



"frameworks": {
"ext": "ext-6.2.0.981"
}


Directory structure:



/(workspace root)
/(app root)
app.json
/ext-6.2.0.981
workspace.json


I've just tried that exact configuration locally without modifying the plugin config and IntelliSense works correctly.

Mark.Brocato
14 Dec 2016, 8:05 AM
I should also mention I'm trying this with the 1.0.0 GA release, which is now available in the support portal.

IvanJ
14 Dec 2016, 9:43 AM
Oh cool, how come no announcement?

Thanks for all your help, Mark! Any hope of getting it to work over Samba? :P

Mark.Brocato
14 Dec 2016, 9:48 AM
Announcement just got posted in the last hour or so. You should see it at the top of the forum. Regarding Samba and network shares in general: We are working on it for 1.0.1. The main problem is that node can't watch for file system events on network shares, so the extension won't know when files change. It's likely that any changes made outside of Visual Studio Code will require a restart to index. Otherwise I think we'll be able to make it work.