Code Monkey home page Code Monkey logo

emacs-import-js's People

Contributors

kevinkehl avatar lencioni avatar thaenalpha avatar trotzig 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

emacs-import-js's Issues

run-import-js error:"Process import-js not running"

I install import-js layer in my .spacemacs.

dotspacemacs-configuration-layers
   '(
     import-js
    ...
   )

install the import-js:

$ npm install -g import-js

also the exec-path:

Its value is
(... "/Users/xxxx/.nvs/node/16.15.0/x64/bin")

when I exec SPC m i i, the error occurs:
Process import-js not running

Support multiple matches

In both pre- and post [email protected], the Emacs plugin doesn't support the case of multiple import matches due to name collisions. The newer version uses the 'add' command to specify which match to use. The emacs plugin would need to implement a method to select one of multiple possible matches from the 'word' command.

Run import-js after snippet completion

Is there a way to trigger import js after yasnippet completion?

I know I can use a custom hook or even yasnippet's 'expand-env' function but what import-js function should I use?

import-js-import will import only on-point expressions,
I would need to use something that takes part of the snippet text as argument

Cannot `run-import-js`

Launching [M-x] run-import-js will give me the following error:

error in process filter: JSON readtable error: 105

I can manually launch the daemon and importjs fix <file> successfully.

  • emacs 26.1-2 on Manjaro
  • import-js 3.2.0
  • watchman 4.9.0
  • node 8.12.0

Let me know if I can provide any help debugging the issue.

Can I import a function which is written in a ts or tsx file

I wrote a next-js page which displays a Example component.

pages/index.tsx

import Head from 'next/head'

export default function Home() {
  return (
    <>
      <Head>
        <title>Create Next App</title>
      </Head>
      <main>
        <Example />
      </main>
    </>
  )
}

And I put the components/Example.tsx like this.

export default function Example() {
  return (
    <div>
      <p>hello </p>
    </div>
  )
}

Then I want to import the Example component, and I run the M-x import-js-import at the index.ts buffer.

But I can't import the Example function.

Is it supported typescript?

Save on window switch writes fixed import result to other window

Hi, thanks for this awesome time saving tool!

I configured import-js-fix to be run via after-save-hook. I also have configured a hook that saves the buffer when I am switching to another buffer/window. Sometimes, when I switch to another window, the "fixed code" (of the buffer I was switching away from) is written to the newly selected window buffer.

I will see whether I find time to investigate this week. I suppose a save-excursion and a buffer switch before updating fixed imports would suffice. Maybe you have a quick idea.

Peace & Love

Searching for program: No such file or directory, importjsd

Already installed the npm package.

Changing this function fix:
(after! import-js
;;;###autoload
(defun run-import-js ()
"Start the import-js daemon"
(interactive)
(kill-import-js)
(let ((process-connection-type nil))
(setq import-js-process (start-process "import-js" nil "importjs" "start" (format "--parent-pid=%s" (emacs-pid))))
(set-process-filter import-js-process 'import-js-handle-data))))

Breaks when json-encoding-pretty-print is set

Hey,

I noticed that the IPC is broken when json-encoding-pretty-print is set, because import-js reads input via readline and there'll be linebreaks in the json when pretty-printing.

Here's a PR that fixes the issue: #22

Fresh install not working

This is the melpa description of the package I just installed:

Status: Available from melpa -- Install
    Archive: melpa
    Version: 20220215.1948
     Commit: d2bbb53f96395415f9f01de4fa88d82c1f59ba63
    Summary: Import Javascript dependencies
   Requires: grizzl-0.1.0, emacs-24
   Homepage: http://github.com/Galooshi/emacs-import-js/
   Keywords: javascript 
 Maintainer: Kevin Kehl <[email protected]>
     Author: Kevin Kehl <[email protected]>

Quick start:
run-import-js

Bind the following commands:
import-js-import
import-js-goto

For a detailed introduction see:
http://github.com/Galooshi/emacs-import-js/blob/master/README.md

Then M-x run-import-js returns on the message buffer:
apply: Searching for program: No such file or directory, importjsd

I do have importjs installed globally with npm:

>> importjs --version
5.0.0

And from inside emacs I can actually run it with e-shell.

I noticed the step 2 on README points to itself, so I can't see if I am missing some config.

Any help?

Thanks!

Using "cd" to change directory for `call-process` breaks helm-find-files

I use helm-find-files (a default package in Spacemacs) to browse directories. It lists all files in the current buffer file's directory.

When I run import-js-import and then execute helm-find-files it now starts me in my import-js-project-root instead of the current buffer file's directory. Regardless of plugins, mutating global state in a plugin like this seems like a scary idea.

According to the emacs documentation, call-process uses the default-directory variable as its working directory. We should be able to wrap the call-process call in a let and change it just for the scope of this call (similar to this SO post).

I'd like to send a PR with this change, but I'm still a bit of an Emacs newb and not sure how to test package changes on my local filesystem. Posting here in case someone else can get to it before I can figure all that out.

Run import-js as a daemon via importjsd

In order to prevent spinning up a new node.js runtime on every import (which can take some time, depending on the system), use the importjsd daemon instead of the CLI tool importjs.

cd: No such directory found via CDPATH environment variable

I use importjs in terminal, it works fine:

chris2@W530-chris:~/Desktop/uhs$ 
importjs word NormalButton src/containers/PatientDetail/FollowUpRecordView/HomeFollowupDetailView/index.js

{"messages":["Imported `../../../../components/NormalButton (main: index.js)`"],"fileContent":"/**\n * Created by isaac on 16/4/29.\n............

but when I use importjs in my emacs it warn: cd: No such directory found via CDPATH environment variable

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.