GithubHelp home page GithubHelp logo

idea-inertiajs-plugin's Introduction

PhpStorm and IntelliJ IDEA Inertia.js Plugin

Build Version Downloads

Note The Laravel Idea plugin provides all the features this plugin provides & more.
Check it out as this plugin may be discontinued in the future.

Provides support in PhpStorm and IntelliJ IDEA Ultimate for Inertia.js.

Credits

idea-inertiajs-plugin's People

Contributors

actions-user avatar dependabot[bot] avatar hailwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

idea-inertiajs-plugin's Issues

Full path is returned when using `\` as directories separator

Bug description
If pages path uses \ as directories separator instead of / the plugin returns the full path instead of the file name.

Example: C:\Users\...\Documents\...\resources\js\Pages

To Reproduce
Change the path to use \ (I don't think it works on Linux)

Environment (please complete the following information):

  • IDE & version: PHPStorm 2020.2.1
  • PHP version: 8.0
  • OS: Windows 11
  • Plugin version : 0.1.1
  • Laravel version: 8.55.0
  • Inertia.js composer version: 0.4.4
  • Inertia.js js version: 0.10.1
  • Typescript: No

Support the Mithril adapter

Is your feature request related to a problem? Please describe.
Currently, the plugin doesn't work with my Mithril adapter

Describe the solution you'd like
Support my Mithril adapter

Describe alternatives you've considered
I've tried setting the path in settings but didn't work

java.lang.Throwable: Assertion failed

Bug description
java.lang.Throwable: Assertion failed at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:220) at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:229) at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.doFindChildById(VirtualDirectoryImpl.java:558) at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$1ParentFinder.findChild(FSRecords.java:539) at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$1ParentFinder.findDescendantByIdPath(FSRecords.java:531) at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.findFileById(FSRecords.java:551) at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.findFileById(PersistentFSImpl.java:1436) at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.findFileById(PersistentFSImpl.java:58) at com.intellij.util.indexing.FileBasedIndexScanUtil.processFilesContainingAnyKey(FileBasedIndexScanUtil.java:244) at com.intellij.util.indexing.FileBasedIndexImpl.processFilesContainingAnyKey(FileBasedIndexImpl.java:1162) at com.intellij.psi.search.FilenameIndex.getVirtualFilesByNames(FilenameIndex.java:219) at com.intellij.psi.search.FilenameIndex.getVirtualFilesByName(FilenameIndex.java:56) at com.jetbrains.php.composer.ComposerUtils.findFileInProject(ComposerUtils.java:133) at nz.hailwood.inertiajs.ExtensionsKt.isInertiaFromComposer(Extensions.kt:19) at nz.hailwood.inertiajs.ExtensionsKt.isInertia(Extensions.kt:15) at nz.hailwood.inertiajs.InertiaStartupActivity$runActivity$$inlined$runReadAction$1.compute(actions.kt:60) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:928) at nz.hailwood.inertiajs.InertiaStartupActivity.runActivity(InertiaStartupActivity.kt:37) at com.intellij.ide.startup.impl.StartupManagerImplKt.runStartupActivity(StartupManagerImpl.kt:511) at com.intellij.ide.startup.impl.StartupManagerImplKt.access$runStartupActivity(StartupManagerImpl.kt:1) at com.intellij.ide.startup.impl.StartupManagerImpl.runActivityAndMeasureDuration(StartupManagerImpl.kt:305) at com.intellij.ide.startup.impl.StartupManagerImpl.runActivityAndMeasureDuration$default(StartupManagerImpl.kt:296) at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$1$1.run(StartupManagerImpl.kt:247) at com.intellij.openapi.project.DumbServiceImpl.runWithWaitForSmartModeDisabled(DumbServiceImpl.java:650) at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$1.accept(StartupManagerImpl.kt:246) at com.intellij.ide.startup.impl.StartupManagerImpl$runPostStartupActivities$1.accept(StartupManagerImpl.kt:70) at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processWithPluginDescriptor(ExtensionPointImpl.java:301) at com.intellij.openapi.extensions.ExtensionPointName.processWithPluginDescriptor(ExtensionPointName.java:143) at com.intellij.ide.startup.impl.StartupManagerImpl.runPostStartupActivities(StartupManagerImpl.kt:241) at com.intellij.ide.startup.impl.StartupManagerImpl.access$runPostStartupActivities(StartupManagerImpl.kt:70) at com.intellij.ide.startup.impl.StartupManagerImpl$projectOpened$$inlined$forkJoinTask$1$lambda$1.invoke(StartupManagerImpl.kt:189) at com.intellij.ide.startup.impl.StartupManagerImpl$projectOpened$$inlined$forkJoinTask$1$lambda$1.invoke(StartupManagerImpl.kt:70) at com.intellij.ide.startup.impl.StartupManagerImplKt$sam$java_lang_Runnable$0.run(StartupManagerImpl.kt) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175) at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:365) at com.intellij.openapi.progress.util.BackgroundTaskUtil.runUnderDisposeAwareIndicator(BackgroundTaskUtil.java:343) at com.intellij.ide.startup.impl.StartupManagerImpl$projectOpened$$inlined$forkJoinTask$1.run(trace.kt:90) at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
To Reproduce
???

Expected behavior
If the description didn't make it clear enough, what should have happened?

Screenshots/Screencasts
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

PhpStorm 2022.2
Build #PS-222.3345.135, built on July 28, 2022
Licensed to Yurij Finiv
Subscription is active until September 17, 2022.
Runtime version: 17.0.3+7-b469.32 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.5.1
GC: G1 Young Generation, G1 Old Generation
Memory: 3048M
Cores: 8
Metal Rendering is ON
Registry:
ide.intellij.laf.enable.animation=true
ide.windowSystem.autoShowProcessPopup=true
run.processes.with.pty=TRUE
editor.distraction.free.mode=true
ide.balloon.shadow.size=0
ide.images.show.chessboard=true

Non-Bundled Plugins:
ski.chrzanow.foldableprojectview (1.1.3)
pl.tigersoft.intellij.faker (1.2.0)
lermitage.intellij.iconviewer (1.15.0.193)
lermitage.intellij.extratci (1.23.0.201)
io.aesy.regex101 (0.2)
intellij.webp (222.3345.108)
ideanginx9 (0.1.9)
de.ehmkah.projects.imgdiff (1.11.0)
com.xiaobing1024.laravel (1.1.1)
com.wakatime.intellij.plugin (14.1.0)
com.mintlify.document (1.1.6)
com.materkey.codepoints (1.0.2)
com.mallowigi.idea (18.1.0)
com.intellij.properties (222.3345.108)
com.wix.sasslint (1.1.2)
com.github.czy211.licensetemplate (2.0.0)
com.github.copilot (1.1.30.1893-nightly)
com.chriscarini.jetbrains.jetbrains-auto-power-saver (2.7.0)
cc.moky.intellij.plugin.svga-support (1.0.8)
bundled-phpstorm-help (222.3345.135)
com.intellij.jira (4.2.0)
String Manipulation (9.5.1)
LiveTemplatePreview (0.3)
Key Promoter X (2022.2)
zielu.gittoolbox (212.9.9)
mobi.hsz.idea.gitignore (4.4.2)
com.mallowigi (65.1.0)
pers.fw.doc_en (1.1)
nl.deschepers.laraveltinker (2.4.0)
de.espend.idea.php.annotation (8.2.3)
com.pestphp.pest-intellij (1.8.1)
com.kalessil.phpStorm.phpInspectionsEA (4.0.7.1)
dev.nybroe.collector (0.4.0)
com.alicannklc.laravel.snippets (1.1.1)
nz.hailwood.inertiajs (0.1.5)
jones.restarteslintaction.restart-eslint-action (0.0.1)
intellij.prettierJS (222.3345.108)
izhangzhihao.rainbow.brackets (6.25)
dev.ekvedaras.laravelquery (3.3.0)
org.i18nally.jetbrainsideplugin (1.4.1.3)
io.snyk.snyk-intellij-plugin (2.4.42)
fr.adrienbrault.idea.symfony2plugin (2022.1.233)
com.mallowigi.colorHighlighter (12.0.0)
com.github.blarc.gitlab-template-lint-plugin (0.0.12)
ru.adelf.idea.dotenv (2022.2)
com.laravel_idea.plugin (5.7.3.221)

  • IDE & version: 2022.2
  • PHP version: 8.1
  • OS: macOS 12.5.1 (21G83)
  • Plugin version : 0.1.5
  • Laravel version: 8.83.23
  • Inertia.js composer version: no
  • Inertia.js js version: no
  • Typescript: No

Additional context
Add any other context about the problem here.

Autocompletion for props property passed by the Controller.

I'm passing data to the view like this.

$user = auth()->user();
return Inertia::render('Auth/Profile', [
    'name' => $user->name,
    'email' => $user->email,
    'is_active' => $user->is_active,
    'posts' => $user->posts,
]);

I would like to have the autocompletion for these props in the React Component, for example when I type props.posts or props.is_active it should autocomplete and gives type hints.

and also autocompletion for the auth property, for example when type props.auth. then the IDE should give me hint that there is a user property on the props.auth.

export default function Profile(props) {
    const { data, setData, patch, processing, errors, reset } = useForm({
        name: props.name,
        email: props.email,
    });
    
    const currentUserName = props.auth.user.name; 
    // Currently I'm not getting any autocompletion or type hint.
    // either I've to read documentation to know that there is a `user` property on the `auth`,
    // or I've to inspect props using React Developer Tools browser extension. this back-n-forth reduces productivity easily.
}

What I used to do back in the blade.php days to get Autocompletion & Type Hints.

@php
/**
* @var App\Models\User $user
*/
@endphp
<div class="card-header">Dashboard</div>

<div class="card-body">
    Your name {{ $user->name }}
    <hr/>
    @foreach($user->posts as $post)
        @php
        /**
        * @var App\Models\Post $post
        */
        @endphp
        <div>
            {{ $post->title }}
        </div>
    @endforeach
</div>

Additional context
I'm using Inertia Laravel & React adapter. and IDE is: Intellij Idea Ultimate.

Thanks for making this beautiful adapter, which eases full-stack development.

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.