Skip to content
New issue

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

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

Already on GitHub? # to your account

Find files on file system using a file pattern #8

Open
bhufmann opened this issue Mar 31, 2020 · 2 comments
Open

Find files on file system using a file pattern #8

bhufmann opened this issue Mar 31, 2020 · 2 comments
Milestone

Comments

@bhufmann
Copy link
Collaborator

To find traces programmatically in the file system where the source code (language server) is. For this I'd like to issue a command on a folder and search for file/directories with a given file pattern. For example:
"From a start directory, find all files with the file suffix *.log"
"From a start directory, find all directories that contains a file called metadata"

@paul-marechal
Copy link
Member

paul-marechal commented Mar 31, 2020

If running from the frontend (browser), you might want to setup a small backend (node) service that will do the search and return the results.

The idea is that the frontend doesn't have direct access to the remote fs. You'd have to use the FileSystem proxy, but if you want to filter files, doing it from the frontend would be sub-optimal.

So this means making a new proxy, where the server would do the filtering based on some input filter, and just return what is of interest.

To implement such a service, you can inspire yourself from the following code:

  1. A "protocol" file with the interfaces your services are going to implement, as well as the unique path that will be used to query said service:
    https://github.com/eclipse-theia/theia/blob/9481af8e21f3be4b2e6658854327d8fa2b390da3/packages/core/src/common/env-variables/env-variables-protocol.ts
    Note how this file is located somewhere under common.
  2. An actual implementation of said interfaces:
    https://github.com/eclipse-theia/theia/blob/9481af8e21f3be4b2e6658854327d8fa2b390da3/packages/core/src/node/env-variables/env-variables-server.ts
    Note how this file is located somewhere under node, because this is code that will run in the node server process.
  3. Register your service as a ConnectionHandler on the backend:
    https://github.com/eclipse-theia/theia/blob/9481af8e21f3be4b2e6658854327d8fa2b390da3/packages/core/src/node/backend-application-module.ts#L72-L78
  4. Register a proxy to your service from the frontend:
    https://github.com/eclipse-theia/theia/blob/9481af8e21f3be4b2e6658854327d8fa2b390da3/packages/core/src/browser/frontend-application-module.ts#L281-L284
    Note how we don't need an implementation on the browser side: the implementation lives on the backend, we just create a proxy that will forward calls for us.

To help you with your actual use case, I would see the following protocol:

export traceFinderPath = '/services/traceFinder'

export interface TraceFinder {

    /**
     * Returns traces under the provided paths (must be directories)
     */
    findTraceRecursive(paths: string[]): Promise<string[]>

}

Then from the frontend, you can remotely call this function by passing the workspace roots to it as paths to find all traces under these folders.

@bhufmann
Copy link
Collaborator Author

bhufmann commented Apr 1, 2020

Thank you very much for the detailed information. Makes sense to separate the backend and frontend for such a search feature. I'll give it a try.

@ebugden ebugden added this to the post-MVP milestone Nov 29, 2021
williamsyang-work added a commit to williamsyang-work/theia-trace-extension that referenced this issue Mar 16, 2023
Adds the Time Range Data Widget to the sidebar as specified in
ADR eclipse-cdt-cloud#8: Time Range Data Widget

The unit controller is linked to the widget by signals. When a new
active tab is loaded or changed, the trace-viewer Theia component
dispatches the new active unit controller via signal-manager. This
signal is picked up by the time-range-data-widget react component.
Because of this, the unit controller is now a public value in the
trace-context-component.

Signed-off-by: William Yang <william.yang@ericsson.com>
dleclairbb pushed a commit to dleclairbb/theia-trace-extension that referenced this issue Oct 25, 2023
The background color of some elements of the extension, like the charts,
was not being changed when a new theme was selected for VSCode.

Now, the extension recognizes if the theme is light or dark and changes
the background of the charts accordingly.

Fixes eclipse-cdt-cloud#8.

Signed-off-by: Rodrigo Pinto <rodrigo.pinto@calian.ca>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants