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

Delete deprecated Tern defs #30657

Open
Danilkat opened this issue Mar 5, 2025 · 3 comments
Open

Delete deprecated Tern defs #30657

Danilkat opened this issue Mar 5, 2025 · 3 comments
Labels

Comments

@Danilkat
Copy link

Danilkat commented Mar 5, 2025

Description

Im refactoring some very old tjs code right now, and ive stumbled upon some fields that are nonexistent in geometry.
The fields that ive found as of now (there might be more):

  • lineDistances
  • lineDistancesNeedUpdate
  • verticesNeedUpdate
  • normalsNeedUpdate

I've confirmed that these fields are nowhere to be found in the three.js' source code, except for one place:
editor\js\libs\tern-threejs\threejs.js

I'm not sure what Tern is, and if there even is a need to delete those fields, but i thought it would be good to have this issue stated somewhere.

Reproduction steps

no repr

Code

no code

Live example

no example

Screenshots

No response

Version

r174

Device

No response

Browser

No response

OS

No response

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 5, 2025

tern used is used for auto-completion in the three.js editor when writing scripts.

Legacy fields can be removed from editor\js\libs\tern-threejs\threejs.js.

@Mugen87 Mugen87 added the Editor label Mar 5, 2025
@s-rigaud
Copy link
Contributor

I'm seeing different approaches to create the script with all advantages and drawbacks:

  1. Parsing the old doc (html)
    • Close to what has already been done (small diff and easier to try)
    • Old documentation (no JsDoc, no TSL function)
  2. Parsing the new doc (html)
    • Getting the type perfectly matching the documentation (future)
    • More experimental and subject to changes
  3. Parsing the code (with babel or recast)
    • Getting all up to date values and properties with JsDoc
    • More complex parsing and filtering (what is private or not)
  4. Parsing the TS type package (with ts-morph)
    • Simple to implement
    • Less up to date version with partially outdated JsDoc and comments

As the original author didn't share the original script to generate the file I don't know which approach is really the best and if it is worth the effort.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 24, 2025

There is an example at https://codemirror.net/examples/autocompletion/ that shows how to setup autocompletion if the source file is annotated with JSDoc (see section Completing from Syntax). An upgrade to CodeMirror 6 is required though (the editor uses 5).

The problem is the CodeMirror 6 examples all expect you are using a build tool and import from the npm package which is not true for the editor. The import paths often use @codemirror/ syntax, and I don't know how to support these in import maps.

E.g.: https://jsfiddle.net/5Lxm4aof/

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

No branches or pull requests

3 participants