submitted 1 week ago* (last edited 1 week ago) by to c/vim@lemmy.sdf.org
 

When I searched for this I saw an answer on Reddit which did not work.

I created the ~/.config/clangd/config.yaml file and using clangd's documentation I found out I needed to put:

Completion:
    HeaderInsertion: Never

Back in Vim, #include statements are still being thrown in willy-nilly. This is incredibly annoying because its inserting C++ libraries when I am using C, and its throwing around unnecessary duplicate includes when I already have a header with all the common includes used throughout the project.

Does anyone use clangd as an LSP in Vim? How do I configure it properly? Where am I supposed to put the config?

Edit: I think my clangd is outdated, as its version 11. I got it through vim-lsp. If I install a newer version into my $PATH will it work with Vim?

Edit2: I solved my own problem. For anyone in the future who is having this issue, the configuration to prevent header insertion is available in clangd-21 or newer. You can simply install the newer clangd using your package manager, on Fedora its dnf install clang-tools-extra. The vim-lsp plugin will automatically use it if its in your system path, which your package manager will handle for you.

[–] [S] 1 point 2 weeks ago* (1 child)

They might be too new, from further testing it seems kernels that are too modern, even if they support 32 bit, do not like this hardware. It needs to be compatible with a Pentium III CPU. It also needs a live environment with a decent toolset so I can actually properly format and test the hard drive, which is either dead or has a corrupted MBR.

  • source
  • parent
  • context
  •  

    The computer originally had Windows 98 installed on it, but when booting it would give a blue screen of death. I've tried a number of things to try and get this laptop working again:

    1. I tried reinstalling Windows 98 since I have the original official disk, after the install and reboot the system displayed the error: "Invalid system disk Replace the disk, and then press any key" I don't know what it means by "system disk"

    2. I tried installing Devuan daedalus, the last 32 bit version of the operating system. It failed.

    3. I tried installing a really old Linux, Fedora 3. The installer ran successfully enough that the hard drive partitions and names appear on other Linux environments, but the system shows the error "Operating System not found"

    4. I booted up TinyCore linux, which successfully runs as a live environment from RAM. It was the one that detected the previous partitions created by the Fedora installer. It also cannot install onto the hard drive (some USB error? I'm using DVD so idk what that's about). I ran fsck successfully once, it told me the hard drive is dos paritioned. So fdisk -l detects Linux partitions, fsck detects dos, what is going on?

    5. I tried SystemRescueCD, which crashed with a kernel panic.

    Is anyone familiar with the ins and outs of an IBM Thinkpad T20? Does anyone know what the "Invalid system disk" error is about, it does not show up in any user manuals I found online. Does anyone know how to get any operating system working on one of these, or a way I can atleast definitively diagnose the issue?

    [–] [S] 2 points 3 weeks ago

    Thanks for bringing that global variable issue to my attention, I'll have to look into it.

    As for the stack, I'll traverse it in reverse for now, I may come back once I've finished the interpreter to clean up the code and add more features.

  • source
  • parent
  • context
  •  

    I'm following along with the book, Crafting Interpreters, but I'm implementing jlox in C# instead, as I thought it would help me understand the code better if I had to do some amount of porting. I am running into language specific issues though, particularly, I believe, with how C# handles null.

    After implementing the resolver from chapter 11, my interpreter can no longer handle for loops (and probably while loops too, though I didn't test this).

    The resolver does not seem to properly store the location of the variable declaration in the for loop in its dictionary. This leads to it passing the wrong 'distance' to the interpreter.

    Here's an example:

    for (var i = 0; i < 10; i = i + 1) {
        print i;
    }
    

    My interpreter will crash with this code that should be valid, because when it encounters print i it won't be able to find the declaration for i. The next chapter of the book is about classes, so this error is not supposed to be here.

    I apologize for the complexity of the code and the low amount of comments, my plan was to complete this part of the book and then reread it and go over and comment all my code so I can understand it better. I've attached a link to the GitHub issue on this post, it has a simple explanation and the stack-trace .NET throws when it encounters a for loop.

    Please let me know if you need more information.

    I won't be surprised if it turns out to be a very simple mistake, but I will facepalm.

    submitted 1 month ago* (last edited 1 month ago) by to c/csharp@programming.dev
     

    I can't figure out what is going on in my program, I'm having a hard time wrapping my mind around what steps its taking to get to the wrong result.

    I have this function which should make my parser ignore C-style comments, ie /* */. When I type /* * */ or any number of * in the comment my program is detecting the * characters inside the comment itself, and when it detects a * it also detects the last /:

    	// Handle C-style comments
    	private void HandleComment() {
    		// Consume until closing characters, multi-line comments are supported
    		while (Peek() != '*' && PeekAhead() != '/' && !IsAtEnd()) {
    			if (Peek() == '\n') line++;
    			Advance();
    		}
    
    		Advance();
    		Advance();
    	}
    

    I figured I would need to Advance() twice in order to consume both the characters that denote the end of the comment.

    Peek(), PeekAhead(), Advance() and IsAtEnd() are functions from the book, Crafting Interpreters, here they are:

    	// Peek at the next char
    	private char Peek() {
    		if (IsAtEnd()) return '\0';
    		return source[current];
    	}
    
    	// Peek after next char
    	private char PeekAhead() {
    		if (current + 1 >= source.Length) return '\0';
    		return source[current+1];
    	}
    
    	private char Advance() {
    		return source[current++];
    	}
    
    	private bool IsAtEnd() {
    		return current >= source.Length;
    	}
    

    The source variable is just a string that contains the text contents of a file or the input from Console.ReadLine().

    I based the comment logic on the string logic here:

    	// Handle string lexemes
    	private void HandleString() {
    		// Consume until closing quote, multi-line strings are supported
    		while (Peek() != '"' && !IsAtEnd()) {
    			if (Peek() == '\n') line++;
    			Advance();
    		}
    
    		// Handle unterminated strings
    		if (IsAtEnd()) {
    			DotLox.Error(line, "Unterminated string.");
    			return;
    		}
    
    		// Consume
    		Advance();
    
    		// Tokenize string and store value without quotes
    		string value = source[(start+1)..(current-1)];
    		AddToken(TokenType.STRING, value);
    	}
    

    I almost forgot to share this crucial bit of logic here:

    	private void ScanToken() {
    		char c = Advance();
    
    		// Match characters to tokens
    		switch(c) {
    
    			// Division and comments
    			case '/':
    				if (Match('/')) {
    					// Consume comment but don't turn it into a token
    					while (Peek() != '\n' && !IsAtEnd()) Advance();
    				} else if (Match('*')) {
    					// Handle C-style comments
    					HandleComment();
    				} else {
    					// Turn lone slash into a token
    					AddToken(TokenType.SLASH);
    				}
    				break;
                    }
           }
    
     

    I found few resources online which may have lead me astray, as I can't get even basic functionality out of LLDB.

    I used the dotnet-sos tool to supposedly automatically load SOS into LLDB and I attached LLDB to my program's process, but I am getting errors when trying to use any command:

    error: 'bpmd' is not a valid command.
    
    error: 'clrstack' is not a valid command.
    

    Its behaving as if SOS isn't installed, I think? I really don't know what is going on, searching for these errors gives me nothing which is insane, usually there would be GitHub issues or Stack Overflow posts. I think I'm about to never touch C# ever again.

     

    Though I primarily use vim, I got VSCodium so I could use it as a debugger since its much easier to set up. I am having alot of trouble getting any use out of it though, when I run the program the IDE gives me errors if I type in the debug console, and closes the terminal if I type in the integrated terminal. I've changed the config to allow integrated terminal, but nothing has changed.

    Can anyone help me figure this out, or recommend an alternative tool for debugging a C# program?

    Edit: I finally found my answer: https://discuss.cachyos.org/t/debugging-c-console-apps-on-linux-with-vs-codium-readline-input-not-working/16493

    Unfortunately there is no FOSS way to debug a C# application in VSCodium. Might have to see what this lldb tool is.

     

    cross-posted from: https://reddthat.com/post/57765446

    Is it even possible? It seems every third-party tool that did it is abandoning the feature and I can't get the deprecated but still present feature to work in Detekt or ktlint. I didn't realise the biggest challenge with Kotlin would be detecting unused import statements so I can easily remove them.

    submitted 6 months ago* (last edited 6 months ago) by to c/programming@programming.dev
     

    Is it even possible? It seems every third-party tool that did it is abandoning the feature and I can't get the deprecated but still present feature to work in Detekt or ktlint. I didn't realise the biggest challenge with Kotlin would be detecting unused import statements so I can easily remove them.

    Edit: Thanks for the help everyone, but I could not get anything working so I eventually just did it manually with a little help from the android linter.

    submitted 1 year ago* (last edited 1 year ago) by to c/selfhosted@lemmy.world
     

    I'm trying to self host my portfolio on an old laptop running Ubuntu server. I've successfully set up docker and nginx. I got a DNS subdomain from freedns.afraid.org.

    The IP connected to the DNS matches my server's public IP address.

    I can connect with https://mypublicip/ from outside the network, but it shows as an insecure connection and the https has lines going through it in the browser.

    Any attempts to connect to the website via DNS have failed, and trying to connect via IP on port 80 fails as well. I really have no clue what is going on, let me know if you need more information, or if this is the wrong place to ask for help with this sort of thing.

    Edit: Whatever problem I had before, it seems its been fixed. However my subdomain is being blocked by ISPs. Thank you for the help everyone, I'll probably have to do cloudflare tunneling instead of fully self-hosting it.

    submitted 1 year ago* (last edited 1 year ago) by to c/paradoxgames@lemmy.world
     

    Whats the deal with this non-standard file type? Has Paradox ever talked about why they created it? Does anyone know when they made this change to the file system?

    Edit: I've been trying to save my edited gamestate by figuring out how to recompress it into a .ck3 file. I don't really know how to replicate the header. Its really a shame I didn't back up the original save. The file starts with SAV and then a unique set of metadata bytes and then the plaintext stuff which, it turns out, is for the main menu and the icon next to the save name, and then it has the rest of the save data compressed with the PK header, which means its in the .zip format. I can replicate all this but the save doesn't properly load due to the incorrect metadata in the header I believe.

    view more: next ›