Giter Club home page Giter Club logo

type4py-vscode-ext's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

type4py-vscode-ext's Issues

Unit/Integration Tests

The extension should be supported by unit and integration tests.

  • Find a way to integrate unit tests with the API
  • Find a way to mock (?) dependencies/requests
  • Write tests for each provider
  • Write general test for infer command
  • Write tests for error cases in the infer command

Pattern matching treats space as literal character

When using : and -> for annotations, adding a space character results in it being treated like a literal character, and thus removing predictions like int, but not predictions that have a space character (e.g. Union[float, int].

The issue should be looked into to see if the space characters can be ignored.

Exception occurs when performing type completion for some variables.

For the file workers.py from here, when performing type completion at line 46 for the variable results_list, the following exception occurs:

Exception has occurred: TypeError: Cannot read property 'forEach' of undefined
t ParamHintCompletionProvider.<anonymous> (/Users/amir/projects/type4py-vscode-ext/dist/extension.js:250:99)
	at Generator.next (<anonymous>)
	at /Users/amir/projects/type4py-vscode-ext/dist/extension.js:212:71
	at new Promise (<anonymous>)
	at /Users/amir/projects/type4py-vscode-ext/dist/extension.js:208:12
	at ParamHintCompletionProvider.provideCompletionItems (/Users/amir/projects/type4py-vscode-ext/dist/extension.js:235:16)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:171333
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:64:11884
	at new Promise (<anonymous>)
	at Object.g [as asPromise] (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:64:11856)
	at F.provideCompletionItems (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:171304)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:190970
	at ze._withAdapter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:181033)
	at ze.$provideCompletionItems (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:190946)
	at d._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:12815)
	at d._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:12507)
	at d._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:11108)
	at d._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:9960)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:88:8064
	at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1835)
	at E.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15634)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:103:29816
	at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1835)
	at E.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15634)
	at t._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:20892)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:17778
	at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1835)
	at c.acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12995)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12343
	at Socket.b (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:103:13287)
	at Socket.emit (events.js:315:20)
	at addChunk (internal/streams/readable.js:309:12)
	at readableAddChunk (internal/streams/readable.js:284:9)
	at Socket.push (internal/streams/readable.js:223:10)
	at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
	at Pipe.callbackTrampoline (internal/async_hooks.js:131:14)

Auto-invoke inference command

Inference command should be auto-invoked when using the Type4Py extension. Some possibilities:

  • Invoke when file is loaded
  • Invoke when file is saved
  • Invoke when file is edited (very expensive)
  • Poll invoke in-between edits (less expensive than on edits)

VSCode Type Extension: Edge Cases

In the future, the following edge cases should be handled. In the prototype stage of the extension, they are rare occurrences and are not highly relevant.

File changes

  • File is renamed: the cached typestore data should react to the event accordingly by updating the cache
  • File is moved: same as above
  • File is deleted: remove cache

Edit events

In general, a mechanism will have to be devised on how the file cache will react when a file is changed. Should some annotations be invalidated, or the Type4Py server call re-triggered? (this should go into it's own issue later on, as it might require changes to the model, server and the client)

Additionally, the line numbers may be invalidated, rendering the cache incorrect (e.g. if all functions shift by 2-3 lines)

Auto-dismiss info messages

UX should be improved by auto-dismissing info messages that pop-up after running the type inference command

Predictions are not shown for self attributes

Currently, the extension does not show predictions for self attributes in a class. Consider the following example:

class Foo:
    def __init__(self, name):
        self.name = name

In this example, the predictions for self.name are not shown, though it exists in the JSON response from the server. Also. line number info is available for self attributes in the JSON output.

Add a setting to use Type4Py's local model

Very recently, I've released Type4Py's Docker image which contains both a local model and a web server. Given this, a new setting should be added to the extension to allow users to utilize the local model without relying on our central server.

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.