jlchmura / lpc-language-server

LPC Language Server
MIT License
11 stars 1 forks source link

Design Pattern Code Snippets/Templates for LPC #59

Closed azerwyn closed 1 week ago

azerwyn commented 1 week ago

I'm unsure if this request is an enhancement request for lpc-language-server or if it should be a separate VSCode extension.

Like any other language, there are good, better, best ways of implementing solutions to frequent objectives. There are snippet extensions for C/C++ to help the experienced save time and the less experienced get off the blank page or avoid chasing a bad idea down the rabbit hole.

Obviously, this flirts dangerously with opinionated practice and perhaps it is better suited to a # design-patterns LPC channel.

The objective being to identify or provide:

  1. Reusable solution templates to common problems in software design
  2. Best practices used by experienced LPC developers (or an extension programmer of a certain charm)
  3. General templates or guidelines that steer developers toward creating well-structured, maintainable, and efficient code
  4. LPC (perhaps driver independent) strategies for solving common problems

Enhancing lpc-language-server might not be the best way forward. Perhaps this 'issue" is simply a brainstorm towards such an end.

Some questions come to mind:

Should "best practice" be something debated to consensus prior to pushing a particular design pattern or are the basic design patterns sufficiently language independent that templates or snippets could be ventured without debate?

Is # snippets and # snippets-archive satisfying this role or is this better addressed in an extension?

I don't know the answer to these questions; thus the spaghetti-at-the-wall approach.

jlchmura commented 1 week ago

I am working on a complete rewrite of the language server and plan to include a "codefix" provider. That is a natural place for this type of feature.

or are the basic design patterns sufficiently language independent that templates or snippets could be ventured without debate

It's an interesting question. In my opinion, snippets that are truly universal should be part of the language server. For example, perhaps if the lang server detects that you've declared a variable mixed foo, but you only ever assign ints to that variable, it could offer a codefix to change the type to int.

So... perhaps the discussion to be had here is not one of best practices, but one of common LPC anti-patterns.

azerwyn commented 1 week ago

Thank you. Your effort here is heroic. I believe your over-the-horizon vision already encompasses my inquiry.