Repository navigation
Closed
Closed
Copy link
Labels
editor-foldingEditor code folding issuesfeature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitiesinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requested
Milestone
Description
Type: Bug
vscode-bug.mp4
-
I made a manual folding range, then another manual folding range including the first one (on ## IMPORT)
-
Tried to remove the first one. It removed the second one (the outer one). Tried to remove first one again, but it sticks.
code in mod-server.py
## IMPORT
# libs
import socket
import os
import sys
import time
import zipfile
# functions
from os.path import exists
## CONFIGURATION
server_configs = ["fiote.mods.bossdirections", "shudnal.NomapPrinter"]
server_excludes = ["ValheimPlus", "ServerSync"] # plugins
client_plugins = ["CustomLoadingScreens"]
client_configs = ["aedenthorn.CustomLoadingScreens"]
## FUNCTIONS
def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
def prepare(outfile): # fetches plugins/configs from server primarily and client specifically
## DEFS
# user consts
global server_configs, server_excludes, client_configs, client_plugins
# parameter consts
compression = zipfile.ZIP_DEFLATED # .ZIP_STORED for no comp
# paths
server_path = "d:/education/valheim-server/"
client_path = "d:/steam-library/steamapps/common/valheim/"
path_base = "bepinex/"
path_configs = path_base + "config/"
path_plugins = path_base + "plugins/"
path_core = path_base + "core/"
path_patchers = path_base + "patchers/"
# install bepinex libs
path_bep_1 = "winhttp.dll"
path_bep_2 = "unstripped_corlib/"
path_bep_3 = "doorstop_libs/"
## INIT
zip = zipfile.ZipFile(outfile, mode="w")
## HELPER FUNCTIONS
def write(path):
zip.write(path, compress_type=compression)
def recwrite(path):
print("root: " + path)
for path, dirs, files in os.walk(path):
if check_exclusion(path): continue
print("|_write root: " + path)
write(path)
for file in files:
print("|_write file: " + file)
write(path + "/" + file)
for dir in dirs:
if os.path.basename(os.path.normpath(dir)) in server_excludes: continue
recwrite(dir)
def check_exclusion(path):
skip = False
for exclude in server_excludes:
if exclude in path:
skip = True
break
return skip
## HANDLE CLIENT PLUGINS/CONFIGS
os.chdir(client_path)
print("changed working folder: " + client_path)
for plugin in client_plugins:
print("writing client plugin: " + plugin)
recwrite(path_plugins + plugin)
client_configs = [config.replace(".cfg","") + ".cfg" for config in client_configs]
for config in client_configs:
print("writing client config: " + config)
write(path_configs + config)
## HANDLE SERVER
os.chdir(server_path)
print("changed working folder: " + server_path)
server_configs = [config.replace(".cfg","") + ".cfg" for config in server_configs]
for config in server_configs:
print("writing config: " + config)
write(path_configs + config)
recwrite(path_plugins)
recwrite(path_core)
recwrite(path_patchers)
write(path_bep_1)
recwrite(path_bep_2)
recwrite(path_bep_3)
zip.close()
update_filesize()
def update_filesize():
global filesize
filesize = str(os.stat(zip_path).st_size)
while len(filesize) < 32:
filesize = " " + filesize
## MAIN
# defs
home_path = sys.path[0]
zip_path = home_path + "/bepinex.zip"
host = get_ip()
port = 7777
# code
s = socket.socket()
s.bind((host,port))
s.listen(1)
s.setblocking(0)
os.system('cls')
print("welcome to mod-server")
filesize = ""
print("listening for clients...")
alert = " "
while True:
time.sleep(1)
if exists("d:/education/valheim-server/halt.txt"):
os.remove("d:/education/valheim-server/halt.txt")
break
# handle clients
try:
c, addr = s.accept()
print("connection from: " + str(addr))
print("creating zip file with plugins to send to clients...")
prepare(zip_path)
print("zip done, sending...")
c.send(filesize.encode())
myfile = open(zip_path, "rb")
c.send(myfile.read())
c.close()
myfile.close()
time.sleep(1)
os.system('cls')
print("file has been sent to " + str(addr))
print("listening for clients...")
except:
alert = "|" if alert == "\\" else ("\\" if alert == "—" else ("—" if alert == "/" else "/"))
# print(" working "+alert,end="\r") # disabled for logging purposesVS Code version: Code 1.89.1 (dc96b83, 2024-05-07T05:13:33.891Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i5-4690K CPU @ 3.50GHz (4 x 3498) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
| Load (avg) | undefined |
| Memory (System) | 15.94GB (7.62GB free) |
| Process Argv | D:\education\valheim-server\mod-server.py --crash-reporter-id a15f87e6-34f2-49ba-9e90-491ecb2e9885 |
| Screen Reader | no |
| VM | 0% |
Extensions (17)
| Extension | Author (truncated) | Version |
|---|---|---|
| vscode-autohotkey-plus | cwe | 2.7.1 |
| vscode-notepad | dev | 0.1.2 |
| language-julia | jul | 1.79.2 |
| vsc-python-indent | Kev | 1.18.0 |
| csharp | ms- | 2.28.11 |
| vscode-dotnet-runtime | ms- | 2.0.5 |
| debugpy | ms- | 2024.6.0 |
| isort | ms- | 2023.10.1 |
| python | ms- | 2024.6.0 |
| vscode-pylance | ms- | 2024.5.1 |
| hexeditor | ms- | 1.10.0 |
| powershell | ms- | 2024.2.1 |
| kb-macro | tsh | 0.13.15 |
| intellicode-api-usage-examples | Vis | 0.2.8 |
| vscodeintellicode | Vis | 1.3.1 |
| material-theme | zhu | 3.17.2 |
| vscode-zig | zig | 0.5.7 |
(13 theme extensions excluded)
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
tftest:31042121
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
showvideoc:31016891
dsvsc021:30996838
bdiig495:31013172
dwnewjupyter:31039675
Reacted by a-pav
Metadata
Metadata
Assignees
Labels
editor-foldingEditor code folding issuesfeature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitiesinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requested
Activity
aeschli commentedon May 14, 2024
Currently
Remove Folding Rangesremoves all manual folding ranges that intersect with the current selection. That's, in your case, the outer (on## IMPORT) and the inner (import socket).The inner reappears and that's because the Python language server creates folding ranges (non-manual) on imports.
Not sure if we should change the
Remove Folding Rangescommand to only remove folding ranges that start on the line where the cursor is set?[-]Remove manual folding range broken in specific instance[/-][+][folding] Remove manual folding range broken in specific instance[/+][-][folding] Remove manual folding range broken in specific instance[/-][+][folding] Remove manual folding range should only remove most inner folding range[/+]matteyas commentedon May 21, 2024
Huh, weird behavior (unless it's configurable), but fair enough. Thanks for letting me know. :)
Imagine having set up some hierarchy (each section has a bunch of code under it, of course):
|-mainfold1
|--fold1
|--fold2
|---fold2.A
|---# this is code inside fold2.A
|---def hello_world():
|--- print("hi tellus")
|--fold3
If my cursor is at the function, I'd like some way to remove only fold2.A. If I press the current hotkey and it erases the entire hierarchy, I'd probably be pretty pissed, for good reasons, no? :D
Anyway, that's just my suggestion.
Thanks, and all the best.
fix: only remove innermost manual folding range at cursor position
fix: only remove innermost manual folding range at cursor position
fix: combine innermost removal with full-range fallback
fix: remove all manual folding ranges when selection is empty (#304793)