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

Add: Workspace symbols #510

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aspeddro
Copy link
Contributor

Close #292

server/src/utils.ts Outdated Show resolved Hide resolved
symbol)

let workspace ~dir =
let open FindFiles in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a bunch of places in the codebase with this kind of code.
Wondering if it's similar enough to grant some refactoring.
Or if the differences are too big to gain something.

E.g. the functionality to read sourceDirectories could be factored out.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a separate issue to track this @cristianoc ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be assessed now, and any follow-on work postponed.

Copy link
Collaborator

@zth zth Jul 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aspeddro will you have a look at this? After that, this should be good for merging.

EDIT: Sorry, this + the other comments about the tests that @cristianoc had.

@cristianoc
Copy link
Collaborator

No tests for the new command yet right?

analysis/tests/test.sh Outdated Show resolved Hide resolved
export let runAnalysis = (args: Array<any>, binaryPath?: string, cwd?: string) => {
let analysisPath = binaryPath != null ? binaryPath : getAnalysisBinaryPath()
export let runAnalysis = (args: Array<any>, cwd?: string) => {
let binaryPath = getAnalysisBinaryPath()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cristianoc
Copy link
Collaborator

@zth not necessarily about this PR, but we should consider beginning to add tests for the TypeScript part of the extension. That's where most breakages have been recently (and where we have no tests).
Instead of going top down, test framework, overhead, unclear utility, i.e. using "best practices". How about doing a quick review of recent breakages and add the least amount of infra required to prevent those from re-occurring. Then build out from there in future.

@zth
Copy link
Collaborator

zth commented Jul 24, 2022

@zth not necessarily about this PR, but we should consider beginning to add tests for the TypeScript part of the extension. That's where most breakages have been recently (and where we have no tests). Instead of going top down, test framework, overhead, unclear utility, i.e. using "best practices". How about doing a quick review of recent breakages and add the least amount of infra required to prevent those from re-occurring. Then build out from there in future.

Sounds good to me. Let's discuss this separately then.

server/src/server.ts Outdated Show resolved Hide resolved
@@ -4,14 +4,14 @@ import * as v from "vscode-languageserver";
import * as rpc from "vscode-jsonrpc/node";
import * as path from "path";
import fs from "fs";
import os from "os";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os is not used

@aspeddro aspeddro marked this pull request as draft July 24, 2022 21:07
@@ -179,7 +188,7 @@
"vscode:prepublish": "npm run clean && npm run compile",
"compile": "tsc -b",
"watch": "tsc -b -w",
"postinstall": "cd server && npm i && cd ../client && npm i && cd ../analysis/tests && npm i && cd ../reanalyze/examples/deadcode && npm i && cd ../termination && npm i"
"postinstall": "cd server && npm i && cd ../client && npm i && cd ../analysis/reanalyze/examples/deadcode && npm i && cd ../termination && npm i"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed cd analysis/tests && npm i. No longer has a package.json file

@aspeddro aspeddro marked this pull request as ready for review July 24, 2022 21:50
@aspeddro
Copy link
Contributor Author

There were the following changes in the tests folder:

  • tests/src/, tests/not_compiled, tests/package.json and tests/bsconfig.json moved to tests/document/ folder.

@aspeddro aspeddro force-pushed the workspace-symbols branch from 181e056 to b5c13b0 Compare July 24, 2022 22:27
@cristianoc
Copy link
Collaborator

The last changes slowed down tests by about 3 seconds each clean build+test.
10 features would slow down 30 seconds, so looking into a more lightweight approach

@cristianoc
Copy link
Collaborator

Let me test something.

@cristianoc
Copy link
Collaborator

cristianoc commented Jul 25, 2022

Oops commit history is gone.
Anyhow, it's just about putting tests into analysis/tests/src/workspace and change nothing in the structure.

@cristianoc
Copy link
Collaborator

This way we also avoid to merge conflict any other PR currently ongoing.

@cristianoc
Copy link
Collaborator

The last changes slowed down tests by about 3 seconds each clean build+test.
10 features would slow down 30 seconds, so looking into a more lightweight approach

Even if that count is inaccurate, we don't want those 3 seconds.
If anything, faster would be better.

@aspeddro
Copy link
Contributor Author

Anyhow, it's just about putting tests into analysis/tests/src/workspace and change nothing in the structure.

Placing tests in analysis/tests/src/workspace will get all symbols in analysis/tests/src/. The workspaceSymbols command needs to read bsconfig.json and get sources.

When putting in tests/workspaces I isolate the files in analysis/tests/src

@cristianoc
Copy link
Collaborator

Anyhow, it's just about putting tests into analysis/tests/src/workspace and change nothing in the structure.

Placing tests in analysis/tests/src/workspace will get all symbols in analysis/tests/src/. The workspaceSymbols command needs to read bsconfig.json and get sources.

When putting in tests/workspaces I isolate the files in analysis/tests/src

Reading bsconfig is always tricky, as there are a bunch of rules, and might change in future.
For example, global rename does not look into bsconfig.

Related question: what about dependencies?

About tests: there's quite a lot of freedom how test commands can be structured, and surely one can pass a folder as parameter or some other restriction to avoid noisy results.

@cristianoc cristianoc mentioned this pull request Jul 26, 2022
@cristianoc
Copy link
Collaborator

Making this run on CI: #519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add navigate to symbols
3 participants