Giter Club home page Giter Club logo

alt's People

Contributors

bbeck-acorns avatar ctsstc avatar drewdeponte avatar exaspark avatar gitter-badger avatar jesse-c avatar keyneston avatar noisyscanner avatar tiagolupepic avatar wezm 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alt's Issues

Improve the vim script

I think it'd be beneficial to craft a nice vim script (which I suppose would be a plugin) for this.

I'm sure there are other things people would like, but the one that's bothering me at the moment is:

  1. Check buffer for alt file before using :edit to open it (this would preserve location in the file)

Multiple alternatives based on framework/language

This is more like a question than an issue regarding the path of this project. I think it would also be useful to get alternatives to .html / .ts / .scss files for Angular development, or similar couplings for other projects.

Current the way of handling alternatives does not allow this, do you think it would be helpful to have 'switching patterns' and get those different patterns in some order so editors can swap them?

For example calling alt with alt --angular would swpa foo.html , foo.ts and foo.scss, or alt --react would suggest foo.jsx or foo.css . Or even alt --c would swap foo.c and includes/foo.h ... even more alt --no-file-check feature so editor can create this file if it does not exists.

Non-fuzzy based searching proposal

alt currently uses fuzzy-based searching based on the filename with scoring. Some languages, like Elixir [1], have conventions for test file locations. What if there was introduced other heuristics? E.g. if an exact match—based on a language's conventions—exists, then return that.

Implementation wise it could be as simple as checking if the file exists, which I can't imagine lowering performance. If anything, this fast return could increase performance as it could skip the fuzzy-based searching since an exact known match was found.

If so, would you be open to a PR that implements this?

The motivation for this was that I wanted to (optionally) create a test file if it didn't already exist when I try and use alt. If the "known file by convention" heuristic was there, then I could do that.

[1] /lib/animal/giraffes/giraffe.ex/test/animal/giraffes/giraffe_test.exs

Need a debug flag

It'd be nice to be able to know why it does (or doesn't) work in various "in the field" scenarios.

Known use cases that we want to support

At this time the following are the known use cases that we want to support.

Cucumber Support

features/project_management.feature <=> features/step_definitions/project_management_steps.rb

Jasmine Javascript Support

spec/foo/bar/jacked_spec.js <=> foo/bar/jacked.js

Elixir ExUnit

test/lib/my_awesome_app/supervisor_test.exs <=> lib/my_awesome_app/supervisor.ex

Hanami Container Arch Support

spec/web/controllers/users/create_spec.rb <=> apps/web/controllers/users/create.rb
spec/web/views/users/create_spec.rb <=> apps/web/views/users/create.rb
spec/foo/bar/car/my_lib_spec.rb <=> lib/foo/bar/car/my_lib.rb
spec/offer_service/fulfiller_spec.rb <=> apps/offer_service/fulfiller.rb

Hanami App Arch Support

spec/controllers/users/create_spec.rb <=> app/controllers/users/create.rb
spec/views/users/create_spec.rb <=> app/views/users/create.rb
spec/foo/bar/car/my_lib_spec.rb <=> lib/foo/bar/car/my_lib.rb
spec/fulfiller_spec.rb <=> app/fulfiller.rb

Rails Support

spec/controllers/tasks_controller_spec.rb <=> app/controllers/tasks_controller.rb
spec/models/task_spec.rb <=> app/models/task.rb
spec/helpers/hoopty_spec.rb <=> app/helpers/hoopty.rb
spec/mailers/hoopty_mailer_spec.rb <=> app/mailers/hoopty_mailer.rb
spec/foo_spec.rb <=> lib/foo.rb
spec/bar/foo_rake_spec.rb <=> bar/foo.rake

Ruby Gem Support

spec/foo_spec.rb <=> lib/foo.rb

Explore alternate matching & ranking algorithms

After some relatively light research it seems that there are three primary string pattern matching algorithms for the scenario of variable pattern & variable text. They are listed below with their various ~ complexities based on my research.

  • Naive - matching ϴ(nm)
  • Rabin-Karp - (randomized linear)
  • Knuth-Morris-Pratt (KMP) - precomputation ϴ(m) matching ϴ(n)
  • Boyer Moore's & Horspool - matching ϴ(mn)

Based on my initial research, ignoring the fact that we are dealing with paths not just normal strings, it seems that KMP is probably the best option for efficiently finding an exact pattern match in some text.

VS Code extension

I started building an Atom package a while back, but have since switched to VS Code as my primary editor (for non-JVM projects).

I'm volunteering myself to write a VS Code extension ✋

Binary release

Would you consider providing binary releases on github or maybe a bottled version of the tap?

Go test support

Firstly, thank you for making this.

With alt 3.1.0, installed through Homebrew on macOS, no alternative files are being found for Go tests. E.g. if I have main.go and main_test.go (same directory), I expect the _test.go file to be found.

Monorepo support

When using in a monorepo (example Lerna), if you run alt from root of the repo, alt is not working.
You need to go the first to one of the package folder

// repo tree example

├── package.json (private module)
├── packages/
│   ├── module1/
│   │   ├── package.json (module)
│   │   ├── src/
│   │   ├── tests/
│   ├── module2/
│   │   ├── package.json (module)
│   │   ├── src/
│   │   ├── tests/

Return file name even if it does not exists

Let's say I'm in Vim, editing app/lib/hashing.py.

app/lib/hashing_test.py does not exist, but I'd like to work on the tests.

Yet this command returns nothing:

$ alt app/lib/hashing.py

I'd be expecting (provided there are some other tests in the repo):

$ alt app/lib/hashing.py
app/lib/hashing_test.py

C/C++ source/header files support

Any plan to support alternate of C/C++ source code - header files?
E.g.:

$ alt ./foo/bar/faz.c
./foo/bar/faz.h

$ alt ./fizz/bang.hpp
./fizz/bang.cpp

Neovim Plugin

It would be really cool to have a Neovim plugin for Alt that handled installation and updating of the binary or even just provided a basic configuration API in Lua and displayed a warning message if it's not installed!

I've been using other.nvim because it provides nice built in commands that I can set keybindings to, but it's not as good at finding alternate files and it's a bit slower. I'd love to switch back to Alt, but having a separate config for it outside of my lazy.nvim config bugs me.

Matching rake spec files (for Rails applications)

New scenario here where Alt cannot find the alternate:

File exists at lib/tasks/something.rake
Test file exists at spec/lib/tasks/something_rake_spec.rb

From something.rake, alt finds the spec file, but from the spec file it cannot find an alternate.

Here's the debug output:

Rake file:

$ alt --debug lib/tasks/intercom.rake
0.08695652173913043: lib/tasks/intercom.rake - spec/controllers/intercom_proxy_controller_spec.rb
0.08804347826086957: lib/tasks/intercom.rake - spec/lib/intercom/batch_enqueuer_spec.rb
0.09518213866039954: lib/tasks/intercom.rake - spec/lib/intercom/bulk_pusher_spec.rb
0.11360448807854139: lib/tasks/intercom.rake - spec/lib/intercom/leads_spec.rb
0.07012622720897616: lib/tasks/intercom.rake - spec/lib/notification_preferences/intercom_preferences_spec.rb
0.391304347826087: lib/tasks/intercom.rake - spec/lib/tasks/intercom_rake_spec.rb
0.11148272017837234: lib/tasks/intercom.rake - spec/queues/intercom/push_batch_spec.rb
path to find alternate for: lib/tasks/intercom.rake
# possible alternate paths: 3100
# filtered possible alternate paths: 7
highest_score: 0.391304347826087
highest_scored_poss_alt_path: spec/lib/tasks/intercom_rake_spec.rb
spec/lib/tasks/intercom_rake_spec.rb

Test file:

alt --debug spec/lib/tasks/intercom_rake_spec.rb
path to find alternate for: spec/lib/tasks/intercom_rake_spec.rb
# possible alternate paths: 3100
# filtered possible alternate paths: 0
highest_score: 0
highest_scored_poss_alt_path:

The reasoning is fairly obvious, it's just because the spec/implementation file names aren't similar enough, or are just kind of structured differently... In any case, it could be a simple matter of adding an exception, but I'm wondering if there's a smarter way to solve it.

I was kind of surprised it couldn't find a possible alternate path to search though... does that make sense to anyone else?

Clarify what "alternate path" actually means

The readme should be more clear what "alternate path" means. Is it the location of a duplicate file? Is it a suggested place to put the file instead of its current location? Or is it maybe something else?

Add support for Swift/Xcode/Swift Package Manager tests

AutomotiveTests/Vehicles/VehicleAttributesVehicleSpec.swift <=> Automotive/Vehicles/VehicleAttributesVehicle.swift
AutomotiveTests/Vehicles/VehicleAttributesVehicleTests.swift <=> Automotive/Vehicles/VehicleAttributesVehicle.swift
AutomotiveUITests/Vehicles/VehicleAttributesVehicleUITests.swift <=> Automotive/Vehicles/VehicleAttributesVehicle.swift
AutomotiveUITests/Vehicles/VehicleAttributesVehicleUISpec.swift <=> Automotive/Vehicles/VehicleAttributesVehicle.swift

Support for x.test.x

I'm surprised to see that this doesn't work:

alt ./crypto-helpers.test.js

I would expect discovery of:

./crypto-helpers.js

... and vise-versa.

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.