Giter Site home page Giter Site logo

ts-type-expand's Issues

Node auto expansion

Add some options to allow users to setup auto expansion or at least expand the first level automatically.

Support windows

In Windows, I get the following error when selecting a node

Error: Node is not defined
    at JP.getTypeFromLineAndCharacter (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:2978)
    at C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:4637
    at HC.middlewares (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:618:122618)
    at d (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:179)
    at next (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:282)
    at n (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:618:121620)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async d (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:173)
    at async next (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:276)
    at async d (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:173)
    at async next (C:\\Users\\owner\\.vscode\\extensions\\kimuson.ts-type-expand-1.0.1\
ode_modules\\ts-type-expand-plugin\\dist\\index.js:627:276)

Code base is here.

https://github.com/d-kimuson/ts-type-expand/blob/master/packages/ts-type-expand-plugin/src/service/compiler-api-handler.ts#L52~L54

Resolve this problem and make it usable for Windows

Add Copy Type Feature

Add a copy feature so that all the properties and sub-properties are copied to the clipboard.

I frequently work with generics and complex types. I would like the ability to copy the types so that I can more easily work with AI.

Copy could either copy only the expanded properties or copy all nested properties. I recommend having a setting to limit nested depth to prevent infinite loops for the 'all nested properties' option.

Enhancement : Allow sorting tree nodes

Quite frequently I need to find a property within a type, and if the type is composed (a union) all of the properties are a mixed jumble. It would help a lot if we could hotkey to sort the properties within a node, and leave the default sorting mode for all tree generation until we change it.
Thanks!

Doesn't work for some destructured types

It works for simple types, but I have some types deep in my project that typescript is kindly showing as a string on hover but the extension sidebar claims it is of type any.

Enhancement: Add filtering option to treeview

It would help if we could do a quick search for props within an object.

You can see this feature implemented in another similar project: TypeScript Explorer

One difference that I'd like to see is the ability to show Only the props that match a specific filter. In the example we see the existing tree is modified with styling. That's good for some purposes, but for others it helps to just see what we want at that moment.

Also note that when filtering for 'onclick' that implementation shows "on" and "click" as well as "onclick". While that could be helpful in rare circumstances I find that to be annoyingly too (non)intuitive. YMMV

You might be able to incorporate the FOSS from that project (with proper attribution of course) as a starting point for this enhancement, or even as-is as just the first version of this feature.

200933940-b735a2a3-cc9d-40de-a4a9-c10c080eead8

Thanks!

1.0.1 version not displaying anything

Can I start by saying I absolutely love this extension, and I can't believe I have only just found it! Super super useful stuff.

I wanted to let you know that the display of the type-tree doesn't seem to render at all in the new 1.x version. I was able to use it just fine with the latest 0.x version, so that's what I'll be using for now, but felt I should make a bug report.

I am on an Intel MacBook Pro (2019) running Monterey 12.6.3. When I try to load the updated extension I get the toast activation message saying it is ready to use, and the title of the sidebar section reads TS TYPE EXPAND (ACTIVE) but the section is completely blank no matter what files I open or what types I click on.

Let me know if you need any more details. Thanks for all your hard work!

Suggestion to modify default Compact Property Length in treeview

Please note from the following that the width of the treeview seems to be limited compared to the width of the view window that contains it. In this example, the props type is TextFieldProps but it's shown as "props: Te...", and yet there is plenty of room for the full display.
Thanks!
image

Option to omit properties starting with _

Many properties starting with _ are private and often noisy.
I would like to provide an option to make this optional.

Also, it would be better to have the sort order backward by default

Is this extension broken?

Installed it, restarted VSCode and opened the TS-Type-Expand window, but nothing happens when I click different types in the editor, it's just blank and empty.

Feature request: Volar takeover mode compatibility

Volar (extension for working with Vue) has a takeover mode in which you disable built-in TypeScript extension and use Volar exclusively, which makes it more performant, because then only 1 language server needs to be created. Unfortunately, this makes it impossible to use this extension, because it depends on the built-in TypeScript extension. It would be great if both could work together, since theoretically Volar should be just an extended built-in language server (although I cannot tell for sure).

Use turborepo for builds.

It has become too much of a hassle to set up watch in parallel with multiple package dependencies during development.

Using `language-service-plugin` to get type information

Currently, building the Compiler API program in watch mode, so we are picking up

  • It takes a long time to start up, and there are many overlapping processes
  • Real-time type retrieval is not possible (the editor has new type information before OnSave, but the extension does not).
  • The version of project's TypeScript and the version of TS used by this extension are different. As a result, the types that are resolved may change.

If you can receive the type information from VSCode's Language Server by some means, all these problems will be solved.

I found an issue that might be useful, so I created an issue.

microsoft/TypeScript#46701

Error: Unexpected intrinsicName Error, [object Object]

I'm using this extension in a Deno project, not a Node project. Maybe that's relevant.
The error only appears when I position the cursor on anything I've imported from an external library.
All my imports of external libraries are done the Deno way, so they look like:

import { xml2js as xml2pojo } from "https://deno.land/x/[email protected]/mod.ts";

And they are cached locally by Deno.
When I hover over the line where I call the function, VSCode is able to show my the type definition of the function, so VSCode itself is not having any troubles:

image

I am just unsatisfied that I can't see what the type of the 2nd function argument (userOptions: Xml2JsOptions) expands into without cmd + click on the function name to navigate to the source file. I was hoping this extension could fix that.

But when I position my cursor on the function name xml2pojo the extension shows nothing and the logs say:

Error: Unexpected intrinsicName Error, [object Object]

Edit

I'm doing a little debugging and I think I have found some useful information. When I cmd + click to go to the source file of the imported xml2js library then this extension doesn't work in that file at all. It raises the error:

SourceFile not found: /https/deno.land/x/[email protected]/xml2js.ts

So I'm just guessing this extension can't work with Deno because:

  1. It doesn't know where Deno caches its imported libraries locally.
  2. And it can't open up a typescript file from a web URL either.

Is that a fair assessment? Please I would super appreciate it if you could fix this.

String literal types should be marked with double quotes

String literals of the same name as a particular type are indistinguishable in the extension

Ex.

Let the string "string" have the type

スクリーンショット 2023-02-11 20 11 38

It displays body: string. We can't tell if it expects a string type or "string" as a literal

スクリーンショット 2023-02-11 20 11 50

Enhancement : Show type name on node root when possible

These screenshots will immedaitely clarify the request.
image
Note mouseover on config reveals the type to be AppConfigJson.
Yes, the treeview shows the typename on mouseover but if there is a type, can we have an option to see it in the tree without mouseover?
image

As another example, note this code and then see how the tree shows it:

type ReactStyles = Record<StyleKeys, CSS.Properties>
type MuiStyles = Record<StyleKeys, CSS.Properties>
...
  styles: {
    current: () => ReactStyles
    react: ReactStyles
    mui: MuiStyles
  }

image

There is plenty of room there to show "Properties (ReactStyles)".

Thanks!

Mapped-Types resolve as unsupported instead of correct type

Hello!

First off: fantastic extension! This adds some sorely needed typing information not provided out of the box with VScode, to say the least!

One issue of note which I believe is not touched upon by the other issues (apologies if I'm incorrect) is that mapped-types resolve as "unsupported". For example:

type OneToThree = 1 | 2 | 3;
type MappedOneToThree = {
  [key in OneToThree]: string;
};

would have an expected expanded type of:

MappedOneToThree
  1: string
  2: string
  3: string

but instead yields:

MappedOneToThree
  1: unsupported
  2: unsupported
  3: unsupported

Again, though, thank-you so much for this wonderful extension!

Stopped working completely

It simply stopped working - no error and nothings shows up. Is there any problem with WSL2 (Windows Subsystem Linux)?

[Bug] Extension have no effect in Linux

Whatever type I select, nothing never appeared inside the panel

Here is a single example:

Peek.2021-09-03.08-30.mp4

VSCode Typescript version: 4.4.2
Local Typescript version: 4.1.6

Treeview shows node value, not full type

Note this type definition and assignment:
image

And it's rendering:
image

This seems related to #331 where in this case "end" is a literal type, not itself a "type".
The actual type of that property is: "bottom" | "top" | "end" | "start" | undefined
That's what I expected to see for that property as the type, not the value, which is of type 'end'.

I know this is complex. :)

Here's a similar case:
image
image

Don't we expect "CSS.Property.BackgroundColor | undefined" there and not the value?

Thanks.

pin or persist an expanded type

Love this extension! What an awesome effort here. Thank you 🙌🏻 .

Anyway, I'd like to request a feature to "pin" a type or in some way, keep a type active in my viewable field while I change active editors.

I am going to start looking for ways to contribute to the VSCode side of things, so perhaps I will try to achieve something for this, but if you have a preference about a way to do this, let me know. I guess a first good step would just be a little pin icon beside the expanded type which would keep it active until unpinned.

INTERNAL_SERVER_ERROR, Error: Node is not defined

The extension doesn't seem to work on my side. Here is the error I get:

{
  "context": "ts-type-expand",
  "level": "error",
  "message": {
    "error": {
      "data": {
        "code": "INTERNAL_SERVER_ERROR",
        "httpStatus": 500,
        "path": "getTypeFromPos",
        "stack": "TRPCError: error: Error: Node is not defined\n    at /home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:4962\n    at HC.middlewares (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:618:122618)\n    at d (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:179)\n    at next (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:282)\n    at n (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:618:121620)\n    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async d (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:173)\n    at async next (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:276)\n    at async d (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:173)\n    at async next (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:276)"
      },
      "meta": {
        "response": {
          "size": 0
        }
      },
      "name": "TRPCClientError",
      "shape": {
        "code": -32603,
        "data": {
          "code": "INTERNAL_SERVER_ERROR",
          "httpStatus": 500,
          "path": "getTypeFromPos",
          "stack": "TRPCError: error: Error: Node is not defined\n    at /home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:4962\n    at HC.middlewares (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:618:122618)\n    at d (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:179)\n    at next (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:282)\n    at n (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:618:121620)\n    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async d (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:173)\n    at async next (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:276)\n    at async d (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:173)\n    at async next (/home/victus/.vscode/extensions/kimuson.ts-type-expand-1.0.1/node_modules/ts-type-expand-plugin/dist/index.js:627:276)"
        },
        "message": "error: Error: Node is not defined"
      }
    },
    "kind": "TRPC_SERVER_ERROR"
  }
}

Return type of "async () => {}" is displayed as "void"

There seems to be something wrong with the handling of async function objects.

Steps to Reproduce

  1. Write the following code.
  2. Open the ts-type-expand panel.
  3. Point foo.
const foo = async () => { };

Expected
ts-type-expand displays the return type of foo as Promise<void>.

Actual
It displays this type as void.

Additional info
const bar= async (): Promise<void> => { }; will be displayed as any.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.