GithubHelp home page GithubHelp logo

id_gen.go too large about opcua HOT 10 OPEN

sruehl avatar sruehl commented on July 29, 2024 1
id_gen.go too large

from opcua.

Comments (10)

sruehl avatar sruehl commented on July 29, 2024

I named common.go to id_names_gen.go in the PR

from opcua.

sruehl avatar sruehl commented on July 29, 2024

Edit: move PR comment on PR #680

from opcua.

kung-foo avatar kung-foo commented on July 29, 2024

I'm kinda on the fence about this. On one hand, I don't like adding complexity and code paths specifically to address IDE and web interface deficiencies, on the other hand, I also use Goland and have hit this issue before (though I "solved" it by bumping up Goland's limits). @magiconair thoughts?

from opcua.

sruehl avatar sruehl commented on July 29, 2024

I can follow the argument and usually have the same stance that it doesn't make any sense to alter code because some IDE is unhappy. But even using VI or any editor this file is just too big 😄.
One note: I utilize the categories (type or whatever edit: NodeClass) the OPC-UA spec provides in the last column of the CSV. So from the spec those IDs are split up already. Splitting them up even more like I suggested would then fall again in the argument I brought up in the first sentence. So practically besides issues in Goland I had trouble generating code from it in plc4x using Java as it would either overflow the maximum number of enums supported 65535 or it would just overflow the static initalizer with too much bytes.
But as I wrote above: It doesn't hurt to segment. The imports/api look completely identical it is just split up into multiple files and makes it even more readable using any editor/viewer.

(edit: referring to #680 in this comment)

from opcua.

magiconair avatar magiconair commented on July 29, 2024

Hmm, this works just fine in VSCode and neovim. Isn't this a limit that you can tune in Goland? Seems like an arbitrary limit.

I could live with splitting the enums and the map into two different files but making a random split because of a Goland limit seems pretty weird. Let's try to fix the IDE first.

image

image

from opcua.

magiconair avatar magiconair commented on July 29, 2024

I also don't follow the code-generation limit argument. The number of enum values does not change. So why would splitting into multiple files not hit that limit?

Also, since the code generator is java you should be able to just provide more memory with -Xmx or not?

I don't think we had such a situation before and I'm also a bit on the fence here. On the one hand this code should just work. On the other hand I don't know how many people actually have this problem and whether the ones who do haven't just updated their settings and moved on. That's what I would do at least.

We can add something to the README if there is a simple workaround. If there isn't and the library is otherwise unusable with either tool then we should fix it.

from opcua.

magiconair avatar magiconair commented on July 29, 2024

If we have to split it up then I'd suggest we do this by id since this doesn't require any complex semantics or regular expressions. For example

id_00000_gen.go
id_10000_gen.go
id_20000_gen.go
...
id_names_gen.go

from opcua.

magiconair avatar magiconair commented on July 29, 2024

@sruehl is this still relevant?

from opcua.

magiconair avatar magiconair commented on July 29, 2024

I've just asked a friend to check this and he says that there is a button to enable the syntax highlighting with the suggestions to bump the memory and the instructions to do so.

from opcua.

sruehl avatar sruehl commented on July 29, 2024

yeah, but as I said this is still a pretty big file and splitting it up with the categories they supply upstream (#680) helps readability.
So even if I fix it for my particular IDE, Github still doesn't render it well.

from opcua.

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.