Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message doesn't get sent if workspace_text is empty #136

Open
dev-ardi opened this issue Nov 15, 2023 · 1 comment
Open

Message doesn't get sent if workspace_text is empty #136

dev-ardi opened this issue Nov 15, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dev-ardi
Copy link

dev-ardi commented Nov 15, 2023

Description

  workspace_text = function(name)
    if name == "" or name == nil then
      return ""
    end

That doesn't work

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1699392533

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

OS information

Linux arch 6.6.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 08 Nov 2023 16:05:38 +0000 x86_64 GNU/Linux

Steps to reproduce

Use "" or the given function in something that doesn't have a filename (like telescope)

Logs

[presence.nvim] Failed to set activity in Discord: Received error event - child "activity" fails because [
child "details" fails because ["details" is not allowed to be empty]] (code 4000)

@dev-ardi dev-ardi added the bug Something isn't working label Nov 15, 2023
@dev-ardi
Copy link
Author

Temporary workaround for me:

local function workspace(name)
    if name == "nvim" then
      return "Wasting time on my config"
    end

    if name == "rust" then
      return "Hacking away at the compiler!"
    end

    if name == "" or name == nil then
      local pwd = vim.fn.getcwd()
      local ws = pwd:match("^.+/(.+)/?$")
      if ws == "" then
        return "I hope you're having a great day :)" -- Friendly error message: This is not allowed to be empty!!
      end
      return workspace(ws)
    end
    return "Working on " .. name
end

then workspace_text = workspace,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant