question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with 'Using Module' and classes

See original GitHub issue

System Details

  • Operating system name and version: Windows 10 Enterprise
PS > code -v
1.17.2
b813d12980308015bcd2b3a2f6efa5c810c33ba5

PS > $pseditor.EditorServicesVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
1      4      1      0


PS > code --list-extensions --show-versions
dbaeumer.vscode-eslint@1.4.0
DotJoshJohnson.xml@1.9.2
ms-mssql.mssql@1.2.0
ms-vscode.PowerShell@1.4.3
streetsidesoftware.code-spell-checker@1.4.10

PS > $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.15063.674
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.674
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When using a class from a different module, the PowerShell plugin cannot locate the class source. I have a module which contains class definitions, then in another module I use the “Using module <ModuleName>” to load the classes into the session for the module to use. It would be nice if the plugin could locate the supplied module and load in the classes to stop the editor “Unable to find type” errors from occurring.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
TylerLeonhardtcommented, May 30, 2018

Just to add on to what @rjmholt said, “Go to definition” doesn’t work because we are using legacy AST APIs to support PowerShell v3/v4 in the extension.

We are looking to drop 3,4 which will allow us to use modern AST APIs which should give us symbols for classes.

I’m going to close this issue because @LethiferousMoose’s original issue is the PSScriptAnalyzer issue that @rjmholt mentioned, and the issue @AlexBillon07 is having is tracked with https://github.com/PowerShell/vscode-powershell/issues/3

If you see otherwise, feel free to drop a message here!

1reaction
AlexBillon07commented, May 30, 2018

My problem is that the “Go to definition” doesn’t work for classes definitions and methods. I get the “No definition found for” bubble where I believe VSCode should be able to locate th definition of a class or a method.

Maybe I misunderstood this ticket and should open a new issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why I Don't Use Classes - Atomic Spin
As somebody above already said, don't ditch classes because inheritance and polymorphism are so terrible. Consider classes modules around ...
Read more >
Module Design Pattern vs Classes in JavaScript
A few examples about the use and differences between Module Pattern and Classes in JavaScript. JavaScript class and Module Pattern examples ...
Read more >
Class vs Module - When classes are needed to be in module?
Classes and modules are not trade-offs, you do not choose one over the other, they serve different purposes. A class helps you model...
Read more >
Replacing JavaScript Classes With The Module Design Pattern
I'm happy moving along without classes for a few key reasons. First of all, the class keyword is nothing but syntactic sugar in...
Read more >
Difference between Module and Class in Python
Then store data where it makes sense to your application. Global state goes in modules (and functions and classes are just as much...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found