Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 509476

Summary: When the opened folder is the project in the Electron app, .tern-project problems cannot be fixed
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2 CC: mamacdon, Olivier_Thomann, steve_northover
Version: 13.0Flags: Olivier_Thomann: review+
Target Milestone: 14.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Michael Rennie CLA 2016-12-19 13:09:49 EST
If you open the Electron app on the folder that is the project - such that the files appear in the root of the navigator - the .tern-project file lint problems cannot be fixed and do not go away.

Steps:

1. create a new folder on disk named myproject
2. open that folder in the Electron app
3. add a file that uses node
4. notice the lint warning about needing to update project settings - click the fix. Nothing happens.
Comment 1 Michael Rennie CLA 2016-12-19 13:51:13 EST
Another part of this problem: since we can't find the right context to modify / create the file, we also do not read the file if it is there.
Comment 2 Michael Rennie CLA 2016-12-19 14:59:52 EST
Created attachment 265956 [details]
Proposed fix

when the project is the root opened file, the project becomes "/file/" in electron.

The patch adds support to the javascriptProject to account for this.
Comment 3 Olivier Thomann CLA 2016-12-19 20:51:22 EST
+1
Comment 4 Steve Northover CLA 2017-01-25 13:52:15 EST
Michael, is this fixed and the patch good?
Comment 5 Michael Rennie CLA 2017-01-27 11:53:49 EST
(In reply to Steve Northover from comment #4)
> Michael, is this fixed and the patch good?

There are some edge cases the patch does not handle, that I am currently working on.
Comment 6 Michael Rennie CLA 2017-01-30 12:35:22 EST
I pushed in support for your project being the root folder:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=e25c0a27ca05bf5620d5ae825db3f7748a638bf5

To support walking back up the tree to find a project context will require an implementation in the server - I tried a client-side-only fix and the performance was terrible.
Comment 7 Steve Northover CLA 2017-01-30 12:56:12 EST
Ok, so do these cases work:

1) The "project" case:

GitRepoWithGoodStuff1

2) The "root" case:

Root
     GitRepoWithGoodStuff1
     GitRepoWithGoodStuff2

3) The "toolchain" case:

Root
   ToolChainName
     GitRepoWithGoodStuff1
     GitRepoWithGoodStuff2

I am guessing that 3) doesn't work (and it also doesn't have to at the moment).
Comment 8 Michael Rennie CLA 2017-01-30 17:44:24 EST
(In reply to Steve Northover from comment #7)
> Ok, so do these cases work:
> 
> 1) The "project" case:
> 
> GitRepoWithGoodStuff1
> 
> 2) The "root" case:
> 
> Root
>      GitRepoWithGoodStuff1
>      GitRepoWithGoodStuff2
> 
> 3) The "toolchain" case:
> 
> Root
>    ToolChainName
>      GitRepoWithGoodStuff1
>      GitRepoWithGoodStuff2
> 
> I am guessing that 3) doesn't work (and it also doesn't have to at the
> moment).

Yes, 1 and 2 work, 3 does not
Comment 9 Steve Northover CLA 2017-01-30 18:09:17 EST
1) and 2) are the current case?  3) is something that we discussed supporting but did not settle on.
Comment 10 Michael Rennie CLA 2017-01-30 20:31:50 EST
*** Bug 509356 has been marked as a duplicate of this bug. ***
Comment 11 Michael Rennie CLA 2017-01-30 20:33:07 EST
(In reply to Steve Northover from comment #9)
> 1) and 2) are the current case?  3) is something that we discussed
> supporting but did not settle on.

Yes, that is the current state. If we can settle on a good (performs and scales well) fix for bug 511326, we can also support 3.
Comment 12 Michael Rennie CLA 2017-01-31 13:00:37 EST
Fixed a bug found with "files in root of workspace":

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=fccf9b8b3b003086f0348dc103f3259d2be3d027
Comment 13 Michael Rennie CLA 2017-02-01 11:09:45 EST
(In reply to Michael Rennie from comment #12)
> Fixed a bug found with "files in root of workspace":
> 
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/
> ?id=fccf9b8b3b003086f0348dc103f3259d2be3d027

Fixed another regression found:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=e709d1a81905515d6ed43731bdd18450dddb8493
Comment 14 Michael Rennie CLA 2017-02-02 12:00:16 EST
Closing fixed.

I opened bug 511590 to track the work of supporting asking the server for project context.