Giter Site home page Giter Site logo

Error while using custom options about neogen HOT 9 CLOSED

danymat avatar danymat commented on August 17, 2024
Error while using custom options

from neogen.

Comments (9)

theairbend3r avatar theairbend3r commented on August 17, 2024 1

Ah, I see. Thank you for the quick response @danymat! Love this plugin btw, amazing work! 😄

from neogen.

kevinhwang91 avatar kevinhwang91 commented on August 17, 2024 1

@danymat Have you reproduced this issue? I have reproduced it.

from neogen.

theairbend3r avatar theairbend3r commented on August 17, 2024 1

Hey, it is working now!

It adds a string "binary_operator" in the Returns part of the docstring when there's no annotation. Is that by design?

def lol(x, y):
  """

  Parameters
  ----------
  x : 
   
  y : 
   

  Returns                                                                                                                                               
  -------                                                                                                                                               
  binary_operator                                                                                                                                       
                                                                                                                                                    
  """                                                                                                                                                   
  return x + y  

It works properly when the function has an annotation for return type.

  def lol(x, y) -> str:    
      """    
      
      Parameters    
      ----------    
      x :     
              
      y :     
              
      
      Returns    
      -------    
      str    
              
      """    
      return x + y 

I've also noticed while testing this out the *args, **kwargs don't show up. See def module_level_function(param1, param2=None, *args, **kwargs): in the Sphinx's NumPy style Python docstrings. Should I create a new issue for this or is it fine here?

def lol(x, y, *args, **kwargs) -> str:
    """                                                      
  
    Parameters  
    ----------  
    x :   
          
    y :   
          
  
    Returns  
    -------  
    str  
          
    """  
    return x + y  

from neogen.

danymat avatar danymat commented on August 17, 2024 1

Hello, you can reference your two problems in a new issue !
I am closing this issue as it seems resolved

from neogen.

danymat avatar danymat commented on August 17, 2024

Hello, can I see your neogen config ?
Did you called the setup() function ?

from neogen.

theairbend3r avatar theairbend3r commented on August 17, 2024

Here's my neogen config-

-- load neogen                                           
local is_neogen_installed, neogen = pcall(require, "neogen")    
if not is_neogen_installed then                                                                                                             
    vim.notify("neogen is not installed.")                                                                                                  
    return                                                                                                                                  
end                                                                                                                                         
                                                                                                                                            
local opts = { noremap = true, silent = true }                                                                                              
local keymap = vim.api.nvim_set_keymap                                                                                                      
keymap("n", "<Leader>gg", ":lua require('neogen').generate()<CR>", opts)                                                                    
                                                                                                                                            
neogen.setup({                                                                                                                              
    enabled = true,                                                                                                                         
    languages = {                                                                                                                           
        python = {                                                                                                                          
            template = {                                                                                                                    
                annotation_convention = "numpydoc",                                                                                         
            },                                                                                                                              
        },                                                                                                                                  
    },                                                                                                                                      
}) 

Here's how I installed it.

use({
    "danymat/neogen",
     requires = "nvim-treesitter/nvim-treesitter",
}) 

I'm running neovim 0.6.1 and the latest version of neogen.

from neogen.

danymat avatar danymat commented on August 17, 2024

Hello, it seems that latest refactor did cause some bugs in that regard

(cc @kevinhwang91) Seems to be the setmetatable in configuration that is not called:

  • here:
    local language = conf.languages[filetype]
    if not language then
    notify("Language " .. filetype .. " not supported.", vim.log.levels.WARN)
    return
    end
    typ = (type(typ) ~= "string" or typ == "") and "func" or typ -- Default type
    local template = language.template
    if not language.parent[typ] or not language.data[typ] or not template or not template.annotation_convention then
  • even here:
    local ft_conf = filetype and conf.languages[filetype] or conf.languages[vim.bo.filetype]
    .
    Can you take a look?.

I will try to come up a fix quickly today if @kevinhwang91 is not active

from neogen.

kevinhwang91 avatar kevinhwang91 commented on August 17, 2024

Please try #67

from neogen.

danymat avatar danymat commented on August 17, 2024

Hello, i merged the fix @kevinhwang91 did, can you try out ?

from neogen.

Related Issues (20)

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.