Coder Social home page Coder Social logo

chrisgrieser / nvim-chainsaw Goto Github PK

View Code? Open in Web Editor NEW
90.0 2.0 7.0 83 KB

Speed up log creation. Create various kinds of language-specific log statements, such as logs of variables, assertions, or time-measuring.

License: MIT License

Lua 100.00%
log-statements logging nvim-plugin print-statements

nvim-chainsaw's Introduction

a.k.a. pseudometa

  • Research Associate in sociology, studying the social mechanisms underlying the digital economy
  • Developer of various plugins for Obsidian, Neovim, and Alfred

pseudometa's github stats

nvim-chainsaw's People

Contributors

ayunker avatar chrisgrieser avatar ishaan-kapoor avatar mcchrish avatar thenbe avatar vbenny42 avatar xlboy 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

Watchers

 avatar  avatar

nvim-chainsaw's Issues

[Bug]: multi-line logs are not removed

Bug Description

I use prettier to format my code so when a log line is too long it will spread it across multiple lines.
Then when I try to remove the lines with removeLogs it only removes the first line of the log.
Example:

console.log("[🪲 dlvhdr] beep 🔵 will return", {
  data: [
    {
      id: `cluster-${services[0].k8sClusterName}`,
      name: services[0].k8sClusterName ?? "",
      kind: WorkspaceKind.Cluster,
      value: {
        clusterName: services[0].k8sClusterName ?? "",
      },
    },
  ],
});

Relevant Screenshot

No response

To Reproduce

  1. Create a long log
  2. Run some formatter or manually spread it to multiple lines
  3. Observe removeLogs only removes the first line.

neovim version

0.10.0

Make sure you have done the following

  • I have updated to the latest version of the plugin.

Why use string markers as opposed to (ext)marks?

Feature Requested

Neovim has a great feature called marks, which essentially act like "bookmarks" for lines. Once you mark a line, you can quickly jump to the mark in one motion.

If chainsaw marked every log line, it would make operations such as deletion easier on these lines. This could help prevent unintentionally deleting actual code which for whatsoever reason includes your marker substring.

Markers behave pretty logically most of the time, the mark moves with the text (if you were to prepend some lines of text before the log line for example), and the mark also gets deleted if you were to delete the line of text using dd. However, I did find one edge case, if i marked a line and then deleted it by going into insert and backspacing away the whole line, the mark shifts onto the line of code below it, ending up marking the wrong line.

I'm personally not super well versed with marks and the nvim lua api, so I'm not too sure how exactly to avoid such edgecases, but if implemented correctly marks have the potential to make bulk operations on log lines more efficient and robust.

Relevant Screenshot

No response

Checklist

  • The feature would be useful to more users than just me.

[Bug]: Beep log counter reset

Bug Description

Thank you for this useful plugin!

When removing beep logs manually the counter is not reset before removeLogs() is called.

edit: same bug applicable to timeLog

Relevant Screenshot

No response

To Reproduce

  1. Open any file, e.g.example.ts
  2. Add beep statement - 1️⃣ is added
  3. Remove the line with dd
  4. Add another beep statement: 2️⃣ is added

neovim version

0.9.5

Make sure you have done the following

  • I have updated to the latest version of the plugin.

[Bug]: timeLogs() entries not following manual removal

Bug Description

The timeLogs() function is not aware of manual entry removal, so it follows the creation loop unconditionally

Relevant Screenshot

No response

To Reproduce

Screenshot.2024-01-17.at.17.28.40.mp4

neovim version

0.9.5

Make sure you have done the following

  • I have updated to the latest version of the plugin.

[Bug]: Error when calling `messageLog`

Bug Description

When I call require('chainsaw').messageLog(), this traceback pops:

.../nvim-data/lazy/nvim-chainsaw/lua/chainsaw/init.lua:31: attempt to call field 'normal' (a nil value)
stack traceback:
  .../nvim-data/lazy/nvim-chainsaw/lua/chainsaw/init.lua:31: in function 'messageLog'

utils.normal is a local function, see below:

u.normal('f";') -- goto insert mode at correct location

local function normal(cmdStr) vim.cmd.normal { cmdStr, bang = true } end

Relevant Screenshot

No response

To Reproduce

  1. Install this plugin
  2. call require("chainsaw").messageLog()

neovim version

NVIM v0.10.0-dev-1988+g1ef60ea65

Make sure you have done the following

  • I have updated to the latest version of the plugin.

[Contact]: debugprint.nvim

Bug Description

Hey @chrisgrieser wasn't sure of another way to get hold of you outside a GitHub issue, apologies for doing it this way. Feel free to connect with me on email at [email protected] (based on my GitHub handle) if you like.

Anyway, I'm the maintainer of https://github.com/andrewferrier/debugprint.nvim, just thought you might be interested in this since there's some similarity with what you're doing with nvim-chainsaw. I guess we came to some of the same ideas independently which is great, just thought you might like to know about it in case there's any ideas you want to adapt or combine efforts in some way. Totally up to you...

By the way, I use both your gx.nvim and nvim-various-textobjs in my own dotfiles, thanks so much for maintaining these!

Relevant Screenshot

No response

To Reproduce

x

neovim version

x

Make sure you have done the following

  • I have updated to the latest version of the plugin.

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.